我们在构建中使用Maven和Ant build.xml文件的组合。maven-antrun-plugin如下:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<!-- Version 1.8 uses Ant 1.9.4 -->
<version>1.8</version>
<executions>
<execution>
<id>Compile sources</id>
<phase>compile</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<mkdir dir="${temp.dir}"/>
<mkdir dir="${dist.dir}"/>
<exec dir="${project.basedir}" executable="${ant.exec}" failonerror="true">
<arg
line="-f xlatedb.ant.xml -DDLC ${dlc} -lib ${lib.dir}
-Dtarget.dir ${target.dir}
-Ddist.dir ${dist.dir}
-Dtemp.dir ${temp.dir}
-Dproject.version ${project.version} "/>
</exec>
</target>
</configuration>
</execution>
</executions>
</plugin>
maven-antrun-plugin内部使用的是Ant 1.9.4版本。有没有一种方法可以使用内部ant jar来替换对${ant.exec}的依赖?
现在,我们向mvn命令传递ant.exec。使用ant任务不起作用,因为我们还需要传递-lib参数给ant(lib文件夹包含所有已下载的依赖项)。
使用ant.exec方法的好处是我们可以使用ant 1.10.5版本。但是,我可以在依赖项中指定ant 1.10.5并将其下载到lib文件夹中...但是,我需要一种方法来使用该1.10.5 jar启动ant而不是启动ant.bat文件。
specify ant 1.10.5 in the dependencies
是指项目依赖关系。在这种情况下,您应该更新此插件的依赖项,对于插件,您也可以更新依赖项。 - Robert Scholte