Build Maven Scala Project with Akka - scala

Usually, I am using SBT to build Scala Projects.
Lately, I have been asked to integer an existing project, they use Maven as development tool.
I wanna work with Maven to build an Akka-Scala Project. I couldn't find any tool to build that.
I tried to make a new Maven project from Eclips (New Project ==> Maven Project), then Add actor library (Proprieties => Build Path => Add Akka Library from external Libraries). But it didn't work.
Can you recommend any IDE/Tool to do that ?

You will need scala-maven-plugging at least for maven to know about Scala. Scala archetype looks like good solution, but I haven't used it. This also may help http://scala-ide.org/docs/tutorials/m2eclipse/index.html

Related

Eclipse Scala IDE: How to build standalone Scala app?

I am writing an app that uses AnormCypher (Cypher-oriented Scala library for Neo4j Server https://github.com/AnormCypher). I write my code in Eclipse Scala IDE. Using sbteclipse plugin I have imported AnormCypher sbt project into Eclipse. Next I have added it to Java build pass as external project. Everything compiles and works from Eclipse now.
Question: How in Eclipse build a standalone Scala program with all necessary dependencies including external Scala project imported in Eclipse?
Trying to create'executable jar' from Eclipse does not work in this case because to do so Eclipse requests "Select a 'Java Application' launch configuration to use to create a runnable JAR." Alas Eclipse here has no idea about Scala launch configuration.
There is not currently a feature of the Scala IDE.
However, it's easy to write a simple build file for your project using sbt. Once there, you can use one of the numerous available plugins to create a distribution for it. Sbt has its own sbt-assembly and sbt-oneJar to create standalone JARs, and there is twitter's sbt-package-dist, with more varied publishing options.

What is the best way to create/build Scala Project

I started learning Scala lately. I find it extremely difficult to -productively- add new project. I was using Visual Studio for years as I am coming from .net development environment.
However, SBT is great tool to build Scala project, but you have to make everything from scratch by your own. It's sometime non productive to make a project that respect the guide lines of Scala () add plugins.build,
I found many alternatives, but I am not sure if these projects are updated:
1- jrebel
http://www.scalatra.org/2.2/getting-started/jrebel.html
2- TypeSafe Templates:
http://typesafe.com/activator/templates
3- Using giter8
github.com/n8han/conscript
IDEs lack some feature such as supporting Akka, in addition to that:
for Eclipse, in the project folder, type sbt eclipse,
for Intellij IDEA, in the project folder, type sbt gen-idea
What is the best way to create and build Akka projects in an interactive way, respecting the guideline of the scala (You can see here the project's architecture www.scalatra.org/2.2/getting-started/project-structure.html)

What is a "build manager" for scala in the scala ide extensions for Eclipse?

In Eclipse in Preferences -> Scala -> Compiler -> Build manager, I can select a "buildmanager." What is the difference between "refined" and "sbt"?
Also, is this some method to integrate an sbt build file into the Eclipse IDE?
ScalaIDE has two build managers, basically they are interfaces between the eclipse model and the scala compiler, they have to do things like work out which resources need re-compiling and how that affects dependent code. Refined is a refined version of the original interface and sbt is, well, sbt.
SBT is the default now, and I expect refined will go away at some point.
Unfortunately the build manager is very much under the hood. There is no real eclipse project->sbt integration yet. There is an eclipse plugin for sbt which allows you to generate eclipse project files but no tight integration from an eclipse project to sbt akin to IvyDE or m2e.
You can use sbt deliver-local to create an ivy file of dependencies, and use IvyDE to keep your classpath containers up to date - that's about as good as it gets at the moment.
I wouldn't be surprised to see this situation improve though - check out the roadmap.

Scala, Maven, Sbt and Eclipse

I am wondering what is the most efficient way to use Sbt and Eclipse together? There seems to be a Sbt Eclipse plugin but what is the generally recommended workflow post generating the eclipse config? It seems kind of wrong to then add dependencies via the Eclipse Maven plugin in Eclipse? Is that what people usually do though?
Kind of new to the ecosystem so maybe I'm missing something here.
I add maven dependencies in via the sbt config files. Then regenerate the eclipse project after each modification, keeping the sbt config as the definitive project specification. I suspect it's the only sane way to run the setup.
I use the IvyDE plugin for eclipse with sbt deliver-local.
The advantage here is it can give you separate classpath containers for different configurations easily and you don't need to blat your eclipse project settings regularly.
It'd be really nice if scala-ide supported tighter integration with sbt.

Working with a Scalatra application in an Eclipse workspace? (i.e. build path)

I am experimenting with a small Scalatra web application, which I have imported as a project into Eclipse.
I have used Eclipse to manage a few Lift applications before. With a Lift project, SBT copies all the dependency JAR's to a /lib_managed directory. I can therefore add those JAR's to Eclipse's build path, and it co-exists with SBT just fine without complaining about missing classes.
With Scalatra, however, the dependency JAR's don't seem to get copied anywhere helpful during the development cycle. If you build a WAR file, then the dependencies get bundled up into that... but there doesn't seem to be anything like Lift's /lib-managed directory.
Assuming that anyone else uses Eclipse in developing Scalatra projects, how might I easily set up Eclipse's build path? I suppose that I could manually create entries that point my local Ivy repository one-by-one, although that seems a bit ugly. Perhaps there's an easy way through SBT to setup something similar to Lift's /lib-managed subdirectory inside the project directory.
It looks like the best approach for this is using the SBT plugin for Eclipse.
This is not an "Eclipse plugin" for managing SBT. Rather, it's an "SBT plugin", for generating the .project and .classpath files used by Eclipse. The Maven world used to deal with Eclipse in a similar manner, before the m2eclipse Eclipse plugin reached maturity over the past couple years.
With this plugin installed (I installed it globally so I wouldn't have to change my project's files), you just type sbt eclipse after any changes to your dependencies. SBT will then update your Eclipse project files to match.
You could also use my Maven prototype, then simply import the maven project into Eclipse. Quite nice and you're not forced to use SBT.
https://github.com/fancellu/scalatra-maven-prototype