3招解决ant构建时任务找不到(taskdef cann't be found)的问题
2014-12-03 10:04
573 查看
在用ant编译项目时,有时会碰到build.xml中所定义的任务找不到的问题:
这是因为ant在当前java的classpath中找不到类LogPublisherTask(LogPublisherTask由
org.apache.tools.ant.Task派生而来),这时候需要重新指定当前的classpath,让它包含LogPublisherTask所属jar库或者class的路径。有三种方法:
1. 在ant命令行指定:
2. 在build.xml指定:
3. 设定当前环境变量CLASSPATH:
其中com.ibm.team.build.toolkit_2.2.0.v20110308_0258.jar包含了类LogPublisherTask的实现。
来源:
http://blog.chinaunix.net/uid-23741326-id-3191369.html
[root@tivu25 test]# ant -f build.xml local_war Buildfile: build.xml local_war: BUILD FAILED /home/haoqf/software/APM/test/build.xml:18: taskdef class com.ibm.team.build.ant.task.LogPublisherTask cannot be found Total time: 0 seconds
这是因为ant在当前java的classpath中找不到类LogPublisherTask(LogPublisherTask由
org.apache.tools.ant.Task派生而来),这时候需要重新指定当前的classpath,让它包含LogPublisherTask所属jar库或者class的路径。有三种方法:
1. 在ant命令行指定:
[root@tivu25 test]# ant -f build.xml local_war -lib /home/haoqf/software/RTC/RTC-BuildSystem-Toolkit-Linux-3.0iFix1/jazz/buildsystem/buildtoolkit/
2. 在build.xml指定:
<?xml version="1.0" encoding="UTF-8"?> <project name="BVT_CVT" default="local_war"> <target name="local_war"> <taskdef name="logPublisher" classname="com.ibm.team.build.ant.task.LogPublisherTask"> <classpath> <pathelement location="/home/haoqf/software/RTC/RTC-BuildSystem-Toolkit-Linux-3.0iFix1/jazz/buildsystem/buildtoolkit/"/> <fileset dir="/home/haoqf/software/RTC/RTC-BuildSystem-Toolkit-Linux-3.0iFix1/jazz/buildsystem/buildtoolkit/"> <include name="**/*.jar"/> </fileset> </classpath> </taskdef> <logPublisher repositoryAddress="${repositoryAddress}" /> </target> </project>
3. 设定当前环境变量CLASSPATH:
[root@tivu25 test]# export CLASSPATH=$CLASSPATH:/home/haoqf/software/RTC/RTC-BuildSystem-Toolkit-Linux-3.0iFix1/jazz/buildsystem/buildtoolkit/com.ibm.team.build.toolkit_2.2.0.v20110308_0258.jar
其中com.ibm.team.build.toolkit_2.2.0.v20110308_0258.jar包含了类LogPublisherTask的实现。
来源:
http://blog.chinaunix.net/uid-23741326-id-3191369.html
相关文章推荐
- 3招解决ant构建时任务找不到(taskdef cann't be found)的问题
- 解决Linux下svn问题:The program 'svn' can be found in following packages...
- iOS 真机测试 Code Sign Error: Provisioning Profile can't be found 问题解决方法
- 问题解决: 找不到SDL 的头文件 can't open include file : SDL.h
- android studio报错Error:Project with path 'XXXX' could not be found解决办法
- Ant-JMS Exception: taskdef class weblogic.ant.taskdefs.management.WLConfig cannot be found
- 安装ADT的时候报错了(关于requires 'org.eclipse.gef 0.0.0' but it could not be found的解决方法)
- The plugin 'org.apache.maven.plugins:maven-eclipse-plugin' does not exist or no valid version could be found 解决
- taskdef class org.apache.catalina.ant.InstallTask cannot be found!
- ant debug 出现的错误:build.xml:49 taskdef class com.android.ant.SetupTask cannot be found(zt)
- Android ADT 升级后 tools\ant\build.xml:828: taskdef class proguard.ant.ProGuardTask cannot be found
- 问题解决:java.sql.SQLException:Value '0000-00-00' can not be represented as java.sql.Date
- ant debug 出现的错误:build.xml:49 taskdef class com.android.ant.SetupTask cannot be found
- 进入'我的电脑'窗口后,左边显示的‘系统任务,其它位置,详细信息’菜单条到删除和出现的问题解决
- Propert 'c' cannot be found in forward class object 'CALayer *错误解决
- but no declaration can be found for element 'authentication-manager'的一种解决办法
- python32版本,出现问题“struct.error: argument for 's' must be a bytes object”的解决办法
- 关于requires 'org.eclipse.gef 0.0.0' but it could not be found的解决方法
- taskdef class com.android.ant.NewSetupTask cannot be found
- taskdef class xdoclet.modules.ejb.EjbDocletTask cannot be found解决办法