【问题标题】:How to wrap an Ant v.1.8.1 build with Maven v. 2.x?如何使用 Maven v. 2.x 包装 Ant v.1.8.1 构建?
【发布时间】:2012-08-01 04:21:27
【问题描述】:

我需要用子项目构建项目,主项目是 Maven 项目,子项目之一是 Ant 项目。 我需要从一个主 pom.xml 编译所有项目 我找到了解决方案How to wrap an Ant build with Maven?,它的答案是正确的,但不适用于我的项目。因为当我的 ant 项目需要 Ant v. 1.8.x,但在构建时使用了

<dependencies>
        <dependency>
            <groupId>ant-contrib</groupId>
            <artifactId>ant-contrib</artifactId>
            <version>1.0b3</version>
            <exclusions>
                <exclusion>
                    <groupId>ant</groupId>
                    <artifactId>ant</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.ant</groupId>
            <artifactId>ant-nodeps</artifactId>
            <version>1.8.1</version>
        </dependency>
    </dependencies>

    <modules>
        <module>Bundles/I_AboutForm</module>
        <module>Bundles/I_AppVars</module>
    </modules>


    <build>
        <plugins>
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>process-resources</phase>
                        <configuration>
                            <!--<taskdef resource="net/sf/antcontrib/antlib.xml" classpathref="maven.plugin.classpath" />-->
                            <tasks>
                                <ant antfile="MainApplication/build.xml" target="compile"/>
                            </tasks>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

maven 下载了 Ant v. 1.7.1 并在构建时使用他(在本地 repo 中有 Ant v.1.8.1)。 我认为,ant-contrib 1.0b3 的依赖可能会出现问题 - 可能是 ant-contrib 依赖于 Ant v. 1.7.1?

请告诉我如何在 Maven 中构建 Ant v. 1.8.x 项目。 谢谢,最好的问候,亚瑟。

【问题讨论】:

    标签: ant maven-2


    【解决方案1】:

    看插件1.7的版本,好像用的是ant 1.8.2的版本 http://maven.apache.org/plugins/maven-antrun-plugin/dependencies.html

    尝试指定插件maven-antrun-plugin的1.7版本

    例如:

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.7</version>
                    <executions>
                        <execution>
    

    【讨论】:

      猜你喜欢
      • 2010-11-30
      • 1970-01-01
      • 2022-01-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-02-17
      • 2019-11-19
      相关资源
      最近更新 更多