简体   繁体   English

有什么简单的方法可以从ant build生成mave pom文件

[英]Is there any easy way to generate mave pom file from ant build

I have a ant build.xml file , how can i directly create a maven pom.xml which is exactly equivalent of build.xml file ? 我有一个ant build.xml文件,如何直接创建一个与build.xml文件完全等效的Maven pom.xml? I know that I can create a maven project and move the folder of build.xml to appropriate folder of maven directories, But is there any automated way of doing this ? 我知道我可以创建一个maven项目并将build.xml文件夹移动到maven目录的相应文件夹中,但是有没有自动的方法呢?

ANT and MAVEN are different so there is probably no such complete automation really. ANT和MAVEN不同,因此实际上可能没有如此完整的自动化。 Still there are some attempts to automate it (see: https://github.com/ewhauser/ant2maven/blob/master/ant2maven.groovy and its forked repositories). 仍然有一些使它自动化的尝试(请参阅: https : //github.com/ewhauser/ant2maven/blob/master/ant2maven.groovy及其分支的存储库)。 Another approach may be to create a pom.xml file and use https://maven.apache.org/plugins/maven-antrun-plugin/ to include the ANT script in it. 另一种方法可能是创建pom.xml文件,并使用https://maven.apache.org/plugins/maven-antrun-plugin/在其中包含ANT脚本。

The simple answer is no. 简单回答是不。 There is no easy way to generate a POM. 没有简单的方法来生成POM。

In my opinion switching to Maven is best left to new projects with little or no legacy to defend. 在我看来,最好是改用Maven,而要保留很少或没有遗产的新项目。 In short Maven is a highly opinionated build tool that follows a standardized build workflow. 简而言之,Maven是遵循标准化构建工作流程的备受赞誉的构建工具。 ANT, on the other, ANT is gloriously configurable... resulting in no two builds working the same way :-) ANT,另一方面,ANT是可配置的……导致没有两个版本以相同的方式工作:-)

A secondary problem is that few ANT builds properly record the origin and version of their 3rd party dependencies... 第二个问题是很少有ANT构建可以正确记录其第三方依赖项的来源和版本...

In most cases you are better off keeping the existing ANT build logic and introduce dependency managment using a plugin like Apache ivy . 在大多数情况下,最好保留现有的ANT构建逻辑,并使用Apache ivy之类的插件引入依赖关系管理。 This allows an ANT project to properly integrate with a Maven repository infrastructure. 这使ANT项目可以与Maven存储库基础结构正确集成。 This further enables collaboration with other teams using alternative build tools like Maven, Gradle or SBT. 这可以进一步使用其他构建工具(例如Maven,Gradle或SBT)与其他团队进行协作。

Related answers: 相关答案:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM