0

我创建了一个 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 插件。这是 > 蚂蚁 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 获取插件,我认为一切都应该到位

非常感谢任何帮助

4

2 回答 2

1

就像您可以向项目添加依赖项一样,您可以向插件添加依赖项。如果您想像您一样使用不同版本的插件依赖项,则特别好。所以你不必等待插件的下一个版本。

请参阅http://maven.apache.org/guides/mini/guide-configuring-plugins.html#Using_the_dependencies_Tag

幸运的是,它实际上是使用 maven-antrun-plugin 作为示例

于 2013-09-07T16:39:13.073 回答
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>

于 2013-09-08T18:15:40.483 回答