Java – Generating a Maven POM from an existing project


Do any of the IDEs (or any other tool for that matter) have the ability to generate a POM based on an existing project?

I ended up generating the POM with a Maven archetype as Peter and Sal suggested and then moving the existing source in. Thanks for the help guys.

Best Answer

One way to do this it to create a template project via maven archetype then move your existing code to the template. I would recommend this only for really simple projects. It would work something like this.

mvn archetype:generate 
mv src/* src/main/java
mv test/* src/test/java
mvn package

You'll get errors. To add the missing dependencies, go here: and start looking them up. If you pick an archetype close to what you need, you'll be half way there.

Once it all works.

svn commit -m "hacky maven port"