我已经创建了一个Maven Ant插件,它根据指南捆绑了大量的Ant宏
http://books.sonatype.com/mcookbook/reference/ch04s04.html http://books.sonatype.com/mvnref-book/reference/writing-plugins-sect-custom-plugin.html#ex-maven-metadata
我有插件工作并使用Ant contrib虽然我有一个问题,它使用
Ant 1.7 而非 1.8 ,这意味着我的包含语句失败
[ERROR] Failed to execute goal com.openbet.shared:openbet-shared_ant:2.4-SNAPSHOT:options (default-cli) on project openbet-office: Failed to execute: Executing Ant script: ci.build.xml [run]: Failed to parse. Problem: failed to create task or type include
[ERROR] Cause: The name is undefined.
[ERROR] Action: Check the spelling.
[ERROR] Action: Check that any custom tasks/types have been declared.
[ERROR] Action: Check that any <presetdef>/<macrodef> declarations have taken place.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
我设法使用echoproperties来验证其1.7
[echoproperties] java.runtime.name=Java(TM) SE Runtime Environment
[echoproperties] ant.file.ci.plugin=/tmp/plexus-ant-component586072324287432616.build.xml
[echoproperties] sun.boot.library.path=/usr/lib/jvm/java-6-sun-1.6.0.26/jre/lib/amd64
[echoproperties] java.vm.version=20.1-b02
[echoproperties] ant.version=Apache Ant version 1.7.1 compiled on June 27 2008
[echoproperties] ant.core.lib=/home/jmorgan/.m2/repository/org/apache/ant/ant/1.7.1/ant-1.7.1.jar
[echoproperties] ant.java.version=1.6
[echoproperties] java.vendor.url=http\://java.sun.com/
[echoproperties] java.vm.vendor=Sun Microsystems Inc.
使用该插件的项目也使用Antrun插件。这是> Ant 1.8
[echoproperties] ant.core.lib=/home/jmorgan/.m2/repository/org/apache/ant/ant/1.8.2/ant-1.8.2.jar
[echoproperties] ant.java.version=1.6
[echoproperties] ant.project.default-target=package
[echoproperties] ant.project.invoked-targets=test
[echoproperties] ant.project.name=maven-antrun-
[echoproperties] ant.version=Apache Ant(TM) version 1.8.2 compiled on December 20 2010
如果我在命令行上运行ant,我会
> ant -v
Apache Ant version 1.8.0 compiled on April 9 2010
我需要做的就是使用1.8获取插件,并且我认为一切都应该落实到位
任何帮助非常感谢
答案 0 :(得分:1)
就像您可以向项目添加依赖项一样,您可以向插件添加依赖项。特别好,如果你想像你一样使用不同版本的插件依赖。因此,您不必等待插件的下一个版本。
请参阅http://maven.apache.org/guides/mini/guide-configuring-plugins.html#Using_the_dependencies_Tag
幸运的是,它实际上是以maven-antrun-plugin为例
答案 1 :(得分:1)
将 ant 添加到我的依赖项中对问题进行了排序
<plugin>
<groupId>com.xxxxx.shared</groupId>
<artifactId>xxxxx-shared_ant</artifactId>
<version>3.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
<version>1.0b3</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.9.2</version>
</dependency>
<dependency>
<groupId>com.oopsconsultancy</groupId>
<artifactId>xmltask</artifactId>
<version>1.16</version>
</dependency>
</dependencies>