Maven project from SBT project convertor? - scala

Is there a way to create (generate) maven project from existing scala sbt project via some script, e.g. automatically?

Execute make-pom from sbt:
sbt make-pom
You'll find the pom in target/scala-2.11/

Related

how to integrate SBT scala in eclipse

how to integrate SBT scala in eclipse? i am following this post as well as
i want to add existing project in scala. how to compile it and how to use build.sbt in eclipse?
SBT integration test setup
and http://grosdim.blogspot.in/2013/01/quick-sbt-tutorial.html
but not finding any useful please help me
how to compile and execute a existing project in eclipse using build.sbt??
You can't use build.sbt in Eclipse directly. Instead you need to generate an Eclipse project from your SBT project using sbteclipse plugin. Quoting the README:
Add sbteclipse to your plugin definition file. You can use either:
the global file (for version 0.13 and up) at ~/.sbt/0.13/plugins/plugins.sbt
the project-specific file at PROJECT_DIR/project/plugins.sbt
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.4.0")
In sbt use the command eclipse to create Eclipse project files
> eclipse
In Eclipse use the Import Wizard to import Existing Projects into Workspace
See the github wiki for more usage details. Don't forget to rerun eclipse command after changes in your SBT project.

How to Point Intellij at SBT Libraries for Scala Project

I'm trying to use this example: https://github.com/spray/spray-template for a Spray project, however I can't figure out how to point Intellij at the dependencies downloaded via SBT.
Any suggestions?
If you're using IntelliJ version 13, you need only the Scala plug-in (which has built-in SBT support); just open the project by selecting the build.sbt file.
Use this SBT plugin to generate Intellij IDEA project files: https://github.com/mpeltonen/sbt-idea
Add SBT plugin for creating IntelliJ IDEA projects in your ~/.sbt/0.xx/plugins/build.sbt or PROJECT_DIR/project/plugins.sbt. Use gen-idea command to create an IntelliJ project and open the project in IntelliJ. That should be it.

how to load activator in intellij with sbt plugin

I'm a novice on sbt.
I looked at activator project
Now I see it uses sbt and there are sbt and scala files under the project directory.
But i was sure there would also be a main sbt (like main pom) in main directory where I can open it in intellij with sbt plugin and it would open all projects in the IDE.
Can anyone please let me know how to open this project in intellij with all its dependencies? Most probably with intellij sbt plugin because it uses sbt (i mean like in maven would bring all sub dependencies)
I never used intellij sbt plugin.
But you could try to add the sbt idea plugin to the plugins.sbt file.
Then you can generate the intellij idea project files with the gen-idea task.

Setting up Akka with Eclipse

I am trying to get a simple Akka program building with Eclipse and Scala. I used g8 to create the sbt project with Akka(g8 typesafehub/akka-scala-sbt) and then sbteclispe to create the Eclipse project. When I import the project into Eclipse I'm given errors saying I am missing Akka. Is there any way that I can build an Akka project with Eclipse?
The simplest thing is to add the sbteclipse plugin to your Sbt build. It automatically generates project files for Eclipse, so that you can import your project with all its settings, classpath included. To do so, add the following under project/plugins.sbt (not in the root of your project, but under the project subdirectory):
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.0")
then, start sbt and at the prompt write eclipse. You should see:
> eclipse
[info] About to create Eclipse project files for your project(s).
[info] Successfully created Eclipse project files for project(s):
[info] Test Project
Then go to Eclipse and Import your project.
I use this to start the 1.x microkernel from the IDE, I think it came from Henke:
Main class : akka.kernel.Main
VM args:
-Xms256m -Xmx1024m -Dakka.home=./kernel -Dlogback.configurationFile=src/main/resources/logback.xml
In kernel directory I have a symlink config -> ../src/main/resources
In the kernel directory I also have an empty deploy directory. Not used, but must be there.

Maven SBT dependency artifacts?

I manage my project using Maven and SBT at same time. The reasons for this are:
Intellij IDEA cannot import SBT
project.(idea-sbt plugin doesn't
work very well)
I don't know how can get sources and
javadocs from SBT.(I'd like to see any answers about this)
The problem is I don't know how to let Maven download SBT dependency. I search through maven repository and couldn't find anything about sbt. I wanna use Maven or SBT to manage all the jars in my project.
If you put a pom.xml to the root of your project, it will be recognized by SBT. When you specify no managed dependencies in the project definition, SBT relies on Maven dependencies.
As it said in SBT doumentation,
sbt performs this dependency handling
when the update action is executed. By
default, sbt does not update your
dependencies before every compilation,
but only does so when you execute
update. sbt supports three ways of
specifying these dependencies:
* Declarations in your project definition
* Maven POM files
* Ivy configuration and settings files
Maven knows nothing about SBT as of now (at least, I've not heard about any plugins so far), so, the best you can do to manage your project both in Maven and SBT, is to generate POMs by SBT. See SBT to Maven Converter for more details.
idea-sbt plugin works great for me with IDEA 10 - all it's really intended to do is open an SBT shell within the IDE and it does that well enough.
A plugin you should look into if you're interested in getting the Maven out of your build is sbt-idea plugin ( https://github.com/mpeltonen/sbt-idea ). This is a great plugin that generates IDEA files from an SBT project. It couldn't be easier to use. At an SBT prompt, run the following commands:
*sbtIdeaRepo at http://mpeltonen.github.com/maven/
*idea is com.github.mpeltonen sbt-idea-processor 0.3.0
update
idea
Note the asterisks - they should be included.
At this point, you can open your project in IDEA. It won't complain about the SBT dependencies. Any time you add new dependencies to your project file, simply run the 'idea' command again to tell IDEA about it. I do that in the SBT window provided by idea-sbt.
As far as getting sources and docs with dependencies, you can do something like this (from the SBT docs):
val sc = "org.scalacheck" % "scalacheck" % "1.5" withSources()
There is a corresponding withJavadoc() method. Hope that helps.