0

我需要用子项目构建项目,主项目是 Maven 项目,子项目之一是 Ant 项目。我需要从一个主 pom.xml 编译所有项目我找到了解决方案如何使用 Maven 包装 Ant 构建?它的答案是正确的,但不适用于我的项目。因为当我的 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 项目。谢谢,最好的问候,亚瑟。

4

1 回答 1

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>
于 2012-08-08T14:46:21.180 回答