Summary: | Enhance error messages of taskdef to say what really is not found... | ||
---|---|---|---|
Product: | Ant | Reporter: | Ralf Hauser <hauser> |
Component: | Core tasks | Assignee: | Ant Notifications List <notifications> |
Status: | ASSIGNED --- | ||
Severity: | enhancement | ||
Priority: | P3 | ||
Version: | 1.5.3 | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | All | ||
URL: | http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16970 | ||
Bug Depends on: | |||
Bug Blocks: | 23741 | ||
Attachments: | this patch to AntClassLoader.java may save many people a lot of worries! |
Created attachment 8534 [details]
this patch to AntClassLoader.java may save many people a lot of worries!
similar problems with inner classes are reported in http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23741 o.k. Thanks to Stefan, I figured that my class-path went too close to the real file. Therefore, my suggestion alter the current error message as follows to prevent "classpath-conventions-ignorants" like myself from endless trials: Current: <<C:\data\MyDocRalf\bin\Java\jars\eclipse\workspace\privaLope\build.xml:76: taskdef class net.sf.cglib.transform.DumpFieldsTask cannot be found>> Suggestions: 1)<<Could not find Class net.sf.cglib.transform.DumpFieldsTask.class in C:\data\MyProj\WEB-INF\classes\net\sf\cglib\transform (the "." in the classname will converted into path delimiters as per your platform.)" 2) debug case: Current: <<Finding class net.sf.cglib.transform.DumpFieldsTask>> Suggestion: as per my http://nagoya.apache.org/bugzilla/showattachment.cgi?attach_id=8534 <<C:\data\MyProj\WEB-INF\classes\net\sf\cglib\transform (the "." in the classname will converted into path delimiters as per your platform. - did you specify a path that is too deep? - did you put the directory of a jar file into the path instead of the jar itself? see also http://ant.apache.org/manual/using.html#path>> Perhaps, it would also be useful to: 3) enhance http://ant.apache.org/manual/using.html#path with a reference to the official java classpath conventions 4) or mention the important parts of the classpath convention there another safeguard would be to warn users who do not have dots "." in their class name that they most likely are forgetting that the "classpath" is basically a "classROOTpath" and need not to go up to the very file. ==> can the fully qualified classname be made mandatory? |
if the class is found but some import not, mention this specifically!! Since I have the target also print the directory path and then verify it manually, I cannot imaging that the classes proper are not found... The current error message is not all to helpful ... :( Background: =========== Somebody sent me two *.java files I can compile in my eclipse, but ant fails to recognize them as tasks even though the provider says he has it running with the same build.xml snippet: <<It's not clear to me why your example isn't working, though, it seems basically correct. Chris > > <property name="dumpFields_dir" > location="${basedir}/WEB-INF/classes/net/sf/cglib/transform"/> > <property name="myProjClasses_dir" > location="${build.dir}/com/myDom/myProj"/> > > <path id="dumpFileClasspath.path"> > <pathelement location="${dumpFields_dir}"/> > </path> > > <target name="dumpfields"><!-- depends="compile"--> > <echo message="${dumpFields_dir}" /> > <taskdef name="dumpfields" classpathref="dumpFileClasspath.path" > classname="net.sf.cglib.transform.DumpFieldsTask" /> > <dumpfields outputFile="${javaConstFile}"> > <fileset dir="${myProjClasses_dir}/business"> > <include name="**/*.class"/> > </fileset> > </dumpfields> > </target> > > I am getting: > > c:\data\\eclipse\workspace\myProj>ant dumpfields > Buildfile: build.xml > > dumpfields: > [echo] > C:\data\eclipse\workspace\myProj\WEB-INF\classes\net\sf\cglib\transform > > BUILD FAILED > file:c:/data/eclipse/workspace/myProj/build.xml:65: taskdef class > net.sf.cglib.transform.DumpFieldsTask cannot be found > > Total time: 3 seconds > > c:\data\eclipse\workspace\myProj>dir > C:\data\eclipse\workspace\privaLope\WEB-INF\classes\net\sf\cglib\tra > nsform > Volume Serial Number is 1A25-17E1 > > Directory of > C:\data\eclipse\workspace\myProj\WEB-INF\classes\net\sf\cglib\transform > > 29.09.2003 19:50 <DIR> . > 29.09.2003 19:50 <DIR> .. > 29.09.2003 19:53 1'726 DumpFieldsTask.class > 29.09.2003 19:53 2'042 DumpFieldsTask$1.class > 29.09.2003 19:53 2'569 AbstractProcessTask.class > 3 File(s) 6'337 bytes>>