Ant <taskdef> problem - classname not found
Asumming I have a build.xml which is already given. I was ordered to add my own task to check some condition and let the build fail if it is not set.
In this build.xml there are already some tasks defined. So i thought i can simply write my own task, place it in a same package like the others and it will work.
<property name"build-dir" value="../base-build" />
<path id="classpath.build">
<fileset dir="${build-dir}/lib" includes="*.jar" />
</path>
<taskdef name="givenTask" classname="test.build.somePackage.GivenTask" classpathref="classpath.build" />
<taskdef name="my开发者_Python百科AddedTask" classname="test.build.someOtherPackage.MyAddedTask" classpathref="classpath.build" />
The build.xml is in the directory base-build, and the packages in build-tools. So my question is: If I copy the taskdef like above and it doesn't work, whats the reason for this? Do I need to add a reference to the path or something?
classname"test.package.build.someOtherPackage.MyAddedTask"
- we have two errors here, maybe typos: first, we miss a =
after classname
, second, the package name is not vaild because it contains a java keyword (package
).
If the snippet was copy and pasted from the original code, then you have to fix it.
精彩评论