将Ant模块转换为Maven,最佳做法是什么?

时间:2016-08-20 15:05:22

标签: java maven ant

许多工具和方法用于从ant转换为maven,但这种迁移的最佳方法是什么? 任何帮助表示赞赏。

1 个答案:

答案 0 :(得分:0)

尽管如此,这些可能还不够,但我在将模块从ant转移到maven时编译了一些常见的做法。

  1. 完全删除build.xml。你不得不重新重写它,因为maven根本没有使用它。
  2. 介绍一个新的pom.xml
  3. 使用<mainClass>src.com.test.Main</mainClass>maven-compiler-plugin中定义主要课程。请参阅this answer。
  4. 对于您在build.xml中使用的.jar,在线搜索其依赖项,然后在pom.xml中添加。您还可以添加local dependencies in your pom.xml
  5. 将图像,文本,音频,视频,文档,pdf,xml传输到资源文件夹。 (另见:What is the purpose for the resource folder?
  6. 有关更多最佳做法,请参阅此答案 Moving onto Maven Anyway...

相关问题