消除 Maven 依赖重复
在我的 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 任务使用。有没有办法通过引用项目的依赖项而不是复制粘贴它们来避免这种重复?
In my Maven build, I use the antrun plugin to invoke an ant task.
<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>
I need to duplicate all the project dependencies in the section indicated, so that they are available to the ant task. Is there a way to avoid this duplication, by referring to the project's dependencies instead of copy-pasting them?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
具体操作方法如下:
参考:
Here's how you can do it:
Reference: