SBT to Maven Converter
Solution 1
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.
Solution 2
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 .
Solution 3
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.
Sawyer
Updated on July 09, 2022Comments
-
Sawyer almost 2 years
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?
-
Sawyer about 13 yearsI tried make-pom, I think my IDE only reads pom.xml file to import a project, do I need to create it manually?
-
Vasil Remeniuk about 13 yearsI 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 runmake-pom
, rename produced artifact definition topom.xml
, and move it to the project root (last two steps can be automated in SBT withpomPostProcess
). -
Trylks over 8 years@VasilRemeniuk I'm having some trouble trying to find how to do those two steps, the documentation says it is a
Node => Node
function. Modifying the root Node and children should be enough to modify the XML, but: how to move the file? Thank you.