或許下面可以幫助你的Maven POM:
<dependencies>
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
<version>1.0b3</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>ant</groupId>
<artifactId>ant</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>ID_HERE</id>
<phase>PHASE_HERE</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<taskdef resource="net/sf/antcontrib/antcontrib.properties" classpathref="maven.plugin.classpath"/>
<if>
<!-- Some if condition here -->
<then>
<!-- Ant tasks to execute if condition is true -->
</then>
</if>
</target>
</configuration>
</execution>
</executions>
<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>
</plugin>
</plugins>
</build>
我明白,這可能不是最優的/有效的解決您的問題,但是這正是我目前使用自己和它的沒有問題的作品。
您是否在Ant項目中輸入了ant-contrib任務?提供對ant-contrib-1.0b3.jar的類路徑依賴是不夠的。 –
我是否需要在Maven-Antrun-Plugin中輸入typedef?如果是這樣,怎麼樣? –
不幸的是,我不確定是否與maven集成可能會影響問題。希望不是。如果處理純粹的Ant,你需要的唯一依賴項就是'ant-contrib-1.0b3.jar'。在使用' '任務之前,您必須在Ant的'build.xml'中使用'「/>'。 –