"无法创建任务或键入的antlib:org.apache.maven.artifact.ant:MVN"错误蚂蚁 [英] "Failed to create task or type antlib:org.apache.maven.artifact.ant:mvn" error in Ant
本文介绍了"无法创建任务或键入的antlib:org.apache.maven.artifact.ant:MVN"错误蚂蚁的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Ant构建失败,而在的build.xml
运行Ant任务运行。我得到了在控制台中出现以下错误:
构建文件:F:\\ Eclipse项目\\ MY_PROJECT \\ build.xml文件
[类型定义]无法加载从资源组织/阿帕奇/行家/神器/ ANT / antlib.xml定义。它不能被发现。构建失败
F:\\ MY_PROJECT \\的build.xml:32:问题:无法创建任务或键入的antlib:org.apache.maven.artifact.ant:MVN
原因:这个名字是不确定的。
操作:检查拼写。
操作:检查所有的自定义任务/类型已经被宣布。
操作:检查任何与LT; presetdef> /< macrodef>声明发生。
任何类型或任务已在此命名空间中定义还这似乎是一个的antlib声明。
操作:检查实施库中的一个存在:
-F:\\日食\\插件\\ org.apache.ant_1.8.3.v20120321-1730 \\ lib中
-C:\\用户\\幸运\\赵军阳张志利\\ lib中
-a目录加入在命令行上与-lib论点
我把Maven的蚂蚁任务jar文件在Eclipse插件的文件夹,并在怀南特ANT_HOME / lib目录中,也包含在类路径。但它并没有解决我的问题和这个答案也未能解决问题。
解决方案
- 在项目的根目录下创建一个
LIB
目录并放置的 Maven的蚂蚁tasks.jar 里面的文件。 - 包含在
的build.xml
import语句
<路径ID =Maven的蚂蚁tasks.classpathPATH =LIB / Maven的蚂蚁任务-2.1.3.jar/>
<的typedef资源=组织/阿帕奇/行家/神器/ ANT / antlib.xmlURI =的antlib:org.apache.maven.artifact.antclasspathref =Maven的蚂蚁tasks.classpath/>
以上步骤解决了我的问题。希望这是有益的人的未来。
替代解决方案,
- 您还可以将
Maven的蚂蚁tasks.jar
的下的文件ANT_HOME / lib目录
文件夹来解决这个问题。 - 或者你可以有它的Eclipse插件文件夹下。
如。日食\\插件\\ org.apache.ant_1.8.3.v20120321-1730 \\ lib中
Ant build failed to run while running the ant tasks in build.xml
. I got the following error in the console:
Buildfile: F:\Eclipse Projects\my_project\build.xml
[typedef] Could not load definitions from resource org/apache/maven/artifact/ant/antlib.xml. It could not be found.
BUILD FAILED
F:\my_project\build.xml:32: Problem: failed to create task or type antlib:org.apache.maven.artifact.ant:mvn
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.
No types or tasks have been defined in this namespace yet
This appears to be an antlib declaration.
Action: Check that the implementing library exists in one of:
-F:\eclipse\plugins\org.apache.ant_1.8.3.v20120321-1730\lib
-C:\Users\Lucky\.ant\lib
-a directory added on the command line with the -lib argument
I placed the maven-ant-tasks jar file in eclipse plugin's folder and in the WinAnt ANT_HOME/lib directory and also included in the classpath. But it didn't solve my problem and this answer also couldn't solve the issue.
解决方案
- Create a
lib
directory in the root of your project and place the maven-ant-tasks.jar file inside it. - Include the import statement in your
build.xml
<path id="maven-ant-tasks.classpath" path="lib/maven-ant-tasks-2.1.3.jar" />
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="antlib:org.apache.maven.artifact.ant" classpathref="maven-ant-tasks.classpath" />
The above steps solved my issue. Hope this is helpful to someone in the future.
Alternate solutions,
- You can also place the
maven-ant-tasks.jar
file under theANT_HOME/lib
folder to solve this issue. - Or you could have it under the eclipse plugins folder.
eg.eclipse\plugins\org.apache.ant_1.8.3.v20120321-1730\lib
这篇关于&QUOT;无法创建任务或键入的antlib:org.apache.maven.artifact.ant:MVN&QUOT;错误蚂蚁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文