Java 如何在AntMaven任务中使用外部库/依赖项?
我目前有一个Maven构建,它调用一个ant任务来运行。此ant任务依赖于一些外部LIB。这些LIB目前在我的系统中是硬编码的。我想将这些外部LIB转移到本地Maven回购协议中,并让Maven从回购协议中检索它们,但不确定如何做到这一点 我的当前任务定义为(为简洁起见,编辑了完整的任务定义):Java 如何在AntMaven任务中使用外部库/依赖项?,java,maven,ant,Java,Maven,Ant,我目前有一个Maven构建,它调用一个ant任务来运行。此ant任务依赖于一些外部LIB。这些LIB目前在我的系统中是硬编码的。我想将这些外部LIB转移到本地Maven回购协议中,并让Maven从回购协议中检索它们,但不确定如何做到这一点 我的当前任务定义为(为简洁起见,编辑了完整的任务定义): maven antrun插件 重命名\u文件 过程资源 跑 我知道我可以将定义为插件def的一部分,但不确定如何重新定义我的taskdef以指向与rar jar文件的依赖关系。经过大量筛选后,我发现
maven antrun插件
重命名\u文件
过程资源
跑
我知道我可以将
定义为插件def的一部分,但不确定如何重新定义我的taskdef
以指向与rar jar文件的依赖关系。经过大量筛选后,我发现我可以做以下工作
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<dependencies>
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
<version>1.0b3</version>
</dependency>
<dependency>
<groupId>org.tigris.antelope</groupId>
<artifactId>antelopetasks</artifactId>
<version>3.4.1</version>
</dependency>
</dependencies>
<executions>
<!-- Ant Custom Folder copying plugin -->
<execution>
<id>rename_files</id>
<phase>process-resources</phase>
<configuration>
<tasks>
<taskdef resource="net/sf/antcontrib/antlib.xml" classpathref="maven.plugin.classpath" />
<taskdef name="stringutil" classname="ise.antelope.tasks.StringUtilTask" classpathref="maven.plugin.classpath" />
<typedef name="trim" classname="ise.antelope.tasks.typedefs.string.Trim" classpathref="maven.plugin.classpath" />
<typedef name="lastindexof" classname="ise.antelope.tasks.typedefs.string.LastIndexOf" classpathref="maven.plugin.classpath" />
<typedef name="substring" classname="ise.antelope.tasks.typedefs.string.Substring" classpathref="maven.plugin.classpath" />
<typedef name="listfiles" classname="ise.antelope.tasks.typedefs.file.FileList" classpathref="maven.plugin.classpath" />
<taskdef name="fileutil" classname="ise.antelope.tasks.FileUtilTask" classpathref="maven.plugin.classpath" />
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
maven antrun插件
抗辩人
抗辩人
1.0b3
org.tigris.antelope
羚羊任务
3.4.1
重命名\u文件
过程资源
跑
只需使用classpathref
并在任务定义中指向maven.plugin.classpath
希望这对将来的其他人有所帮助
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<dependencies>
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
<version>1.0b3</version>
</dependency>
<dependency>
<groupId>org.tigris.antelope</groupId>
<artifactId>antelopetasks</artifactId>
<version>3.4.1</version>
</dependency>
</dependencies>
<executions>
<!-- Ant Custom Folder copying plugin -->
<execution>
<id>rename_files</id>
<phase>process-resources</phase>
<configuration>
<tasks>
<taskdef resource="net/sf/antcontrib/antlib.xml" classpathref="maven.plugin.classpath" />
<taskdef name="stringutil" classname="ise.antelope.tasks.StringUtilTask" classpathref="maven.plugin.classpath" />
<typedef name="trim" classname="ise.antelope.tasks.typedefs.string.Trim" classpathref="maven.plugin.classpath" />
<typedef name="lastindexof" classname="ise.antelope.tasks.typedefs.string.LastIndexOf" classpathref="maven.plugin.classpath" />
<typedef name="substring" classname="ise.antelope.tasks.typedefs.string.Substring" classpathref="maven.plugin.classpath" />
<typedef name="listfiles" classname="ise.antelope.tasks.typedefs.file.FileList" classpathref="maven.plugin.classpath" />
<taskdef name="fileutil" classname="ise.antelope.tasks.FileUtilTask" classpathref="maven.plugin.classpath" />
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>