Since most IDEs are only able to import Maven projects, I'd like to generate a POM.xml from an SBT managed project, is there a better way to do it?
Asked
Active
Viewed 2.5k times
38
-
You should probably add a maven tag to this Q. – Adam Gent Feb 21 '11 at 15:05
-
Another reason to generate POMs sometimes is that `mvn dependency:tree` usually works properly, but `sbt dependency-tree` often doesn't. It seems to leave off some dependencies. – Ken Williams Apr 29 '15 at 18:08
-
Outdated question, now IDEs import Sbt project also. – Waldemar Wosiński Oct 20 '15 at 12:28
3 Answers
49
Did you try make-pom
from sbt?
It generates basic POM for the current project at the ./target.
To customize generation, you can override pomExtra
, pomIncludeRepository
and pomPostProcess
at the project definition.

Saurabh
- 71,488
- 40
- 181
- 244

Vasil Remeniuk
- 20,519
- 6
- 71
- 81
-
1I tried make-pom, I think my IDE only reads pom.xml file to import a project, do I need to create it manually? – Sawyer Feb 21 '11 at 15:47
-
4I use `make-pom` to import SBT projects into Netbeans (that supports only Maven- and Ant-based project out of the box). It has always been taking for me just to run `make-pom`, rename produced artifact definition to `pom.xml`, and move it to the project root (last two steps can be automated in SBT with `pomPostProcess`). – Vasil Remeniuk Feb 21 '11 at 15:50
-
@VasilRemeniuk I'm having some trouble trying to find how to do those two steps, the [documentation](http://www.scala-sbt.org/0.13/docs/Publishing.html) says it is a `Node => Node` function. Modifying the root [Node](http://www.scala-lang.org/api/2.10.3/index.html#scala.xml.Node) and children should be enough to modify the XML, but: how to move the file? Thank you. – Trylks Aug 09 '15 at 09:58
8
There is a very direct way provided by SBT. You can use the below command where your SBT file exixts:
sbt makePom
This will generate the .pom file in the target folder you can search that and rename to pom.xml and keep that file in the location and run mvn clean compile install to get full out of it.

Amit khandelwal
- 504
- 5
- 6
6
Vasil's answer is correct, but for Eclipse and IDEA you can generate IDE metadata more directly using plugins. For IDEA https://github.com/mpeltonen/sbt-idea, and for Eclipse https://github.com/musk/SbtEclipsify .

James Iry
- 19,367
- 3
- 64
- 56