Generating a Maven POM from an existing project?

后端 未结 4 1093
眼角桃花
眼角桃花 2020-12-30 03:04

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 Ma

4条回答
  •  清歌不尽
    2020-12-30 03:55

    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: http://www.mvnrepository.com/ 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"
    

提交回复
热议问题