Bug 14931 - taskdef ignores classpath attribute in some cases
Summary: taskdef ignores classpath attribute in some cases
Status: RESOLVED DUPLICATE of bug 38799
Alias: None
Product: Ant
Classification: Unclassified
Component: Core tasks (show other bugs)
Version: 1.5.1
Hardware: All All
: P3 minor (vote)
Target Milestone: ---
Assignee: Ant Notifications List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-11-28 14:28 UTC by Daniel Knauth
Modified: 2008-02-22 12:18 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Knauth 2002-11-28 14:28:19 UTC
A <taskdef> ignores its stated classpath settings in cases when the classname
attribute can be resolved via the default ant classpath.

This setup:

  <path id="junit.runtime.path">
    <pathelement
location="${cvs.checkout}/gate5ag/Devel/Java/Lib/jakarta/ant-optional.jar" />
    <pathelement
location="${cvs.checkout}/gate5ag/Devel/Java/Lib/junit/junit.jar" />
  </path>

    <taskdef name="junit"
classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"
           classpathref="junit.runtime.path" />

gives me a ClassNotFoundExc because junit.framework.TestListener cannot be found
  if optional.jar is in $ANT_HOME/lib, and junit.jar is not.

Removing optional.jar from $ANT_HOME/lib fixes this; adding junit.jar to
$ANT_HOME/lib does fix it as well.


Seems to me that taskdef ignores my classpath if it can load
org.apache.tools.ant.taskdefs.optional.junit.JUnitTask via the default
classloader, then tries to load the junit classes via the default CL as well.
Of course this fails in the above setup.

Why does taskdef use the boot CL in the first place?
Comment 1 Stefan Bodewig 2002-11-28 14:40:34 UTC

*** This bug has been marked as a duplicate of 6606 ***
Comment 2 Jesse Glick 2006-02-27 20:43:58 UTC
More precise duplicate.
Comment 3 Jesse Glick 2006-02-27 20:44:22 UTC

*** This bug has been marked as a duplicate of 38799 ***