在我的Maven构建中,我使用antrun插件来调用ant任务。
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>compile</phase>
<configuration>
<tasks>
<property name="plugin_classpath" refid="maven.plugin.classpath" />
<java classname="org.apache.tools.ant.launch.Launcher"
fork="true" failonerror="true">
<classpath>
<pathelement path="${plugin_classpath}" />
</classpath>
</java>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<dependencies>
<!-- DEPENDENCIES FROM PROJECT DUPLICATED HERE -->
</dependencies>
</plugin>
我需要复制指定部分中的所有项目依赖项,以便它们可用于ant任务。有没有办法避免这种重复,通过引用项目的依赖项而不是复制粘贴它们?
答案 0 :(得分:1)
以下是您可以这样做的方法:
<property name="plugin_classpath" refid="maven.plugin.classpath" />
<property name="compile_classpath" refid="maven.compile.classpath" />
<java classname="org.apache.tools.ant.launch.Launcher"
fork="true" failonerror="true">
<classpath>
<pathelement path="${plugin_classpath}" />
<pathelement path="${compile_classpath}" />
</classpath>
</java>
<强>参考:强>