How to convert Ant project to Maven project

江枫思渺然 提交于 2019-11-27 05:39:36

问题


How to convert a Ant project to Maven project? A sample project that would link (a Wicket project)

Thanks


回答1:


The nice part of using maven is that most standard stuff works automatically once you do things the maven way. For a simple webapp:

  1. Create a pom with groupId, artifactId and version (packaging: war)
  2. Add the required dependencies to the pom
  3. move the
    • java sources to src/main/java,
    • resources to src/main/resources,
    • webapp content to src/main/webapp,
    • test content to src/test/java and src/test/resources
  4. set the compiler compliance version using the maven compiler plugin

That should get you up 'n' running.




回答2:


http://www.sonatype.com/people/2009/04/how-to-convert-from-ant-to-maven-in-5-minutes/

I don't know what your ant script looks like, but assuming its a basic script for building, you will need to create a pom.xml file for your project, add your dependencies, and then build it via maven.




回答3:


For anyone who lands here in future, there is an easier way to find dependencies for maven using the file hashes. So, you won't have to guess artifact versions.

As per the below article, the idea is to generate a SHA1 checksum of the dependency that you want to find the information, then do a reverse search in Nexus repository manager using that hash. For the checksum generation, you can use Microsoft's FCIV (free) utility.

https://devreads.xyz/ant-to-maven-conversion-the-painless-method/



来源:https://stackoverflow.com/questions/4029501/how-to-convert-ant-project-to-maven-project

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!