antlib 和类路径引用 [英] antlib and classpathref
本文介绍了antlib 和类路径引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下 build.xml 文件:
I have the following build.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<project name="Minimal" default="default" basedir="." xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<path id= "libs.folder" >
<fileset dir= "lib" >
<include name= "*.jar" />
</fileset>
</path>
<typedef resource="org/tigris/subversion/svnant/svnantlib.xml" classpathref="libs.folder" />
<taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy" classpathref="libs.folder"/>
<artifact:pom id="pom.file" file="pom.xml" />
<property name="pom.version" value="${pom.file.version}"/>
<groovy src="test.groovy">
<arg line="3"/>
</groovy>
...
位于以下结构中:
my-project
-> lib
-> maven-ant-tasks.jar
-> svnant.jar
-> groovy-all.jar
-> svnClientAdapter.jar
-> build.xml
-> pom.xml
-> test.groovy
当我运行构建文件时,我得到:
when I run the build file I get:
BUILD FAILED
....\build.xml:18: Problem: failed to create task or type antlib:org.apache.maven.artifact.ant:pom
Cause: The name is undefined.
Action: Check the spelling.
如果我运行:
ant -lib lib
它可以工作,但最好将所有内容都保存在 build.xml 文件中 - 就像使用 groovy 和 svnant 库一样.
it works but it could be nice to keep everything inside the build.xml file - like with the groovy and svnant libs.
这可以通过 maven-ant-tasks.jar 以某种方式实现吗?
is this possible with the maven-ant-tasks.jar somehow?
推荐答案
将 maven-ant-tasks-2.x.x.jar 和 maven-ant-tasks-2.x.x.pom 复制到/lib.
Copy both maven-ant-tasks-2.x.x.jar and maven-ant-tasks-2.x.x.pom to /lib.
http://search.maven.org/#search|ga|1|a%3A%22maven-ant-tasks%22
注意:在 http://maven.apache.org/ant-tasks/阅读更多内容一个>
这篇关于antlib 和类路径引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文