You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2012/04/09 10:32:44 UTC

DO NOT REPLY [Bug 53049] New: Classpath entries passed to a junit task don't get received by jUnit test classes

https://issues.apache.org/bugzilla/show_bug.cgi?id=53049

             Bug #: 53049
           Summary: Classpath entries passed to a junit task don't get
                    received by jUnit test classes
           Product: Ant
           Version: 1.8.3
          Platform: PC
            Status: NEW
          Severity: critical
          Priority: P2
         Component: Core tasks
        AssignedTo: notifications@ant.apache.org
        ReportedBy: a320395040@gmail.com
    Classification: Unclassified


Created attachment 28560
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=28560
An Ant project demonstrating the problem, and a maven project showing an
expected outcome.

Here is a working example showing the Ant problem with classpaths.
DummyTest simply outputs the classpath received.
The problem is Ant doesn't append classpath entries defined within a junit task
as per build.xml given.
I have made an example of a project employing Maven to demonstrate what kind of
output I expect to see.
Here is the output of 'ant test':

test:
    [junit] Testsuite: test.DummyTest
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.017 sec
    [junit] ------------- Standard Output ---------------
    [junit] C:\Java\apache-ant-1.8.3\bin\..\lib\ant-launcher.jar
    [junit] C:\Java\apache-ant-1.8.3\lib\ant-antlr.jar
    [junit] C:\Java\apache-ant-1.8.3\lib\ant-apache-bcel.jar
    [junit] C:\Java\apache-ant-1.8.3\lib\ant-apache-bsf.jar
    [junit] C:\Java\apache-ant-1.8.3\lib\ant-apache-log4j.jar
    [junit] C:\Java\apache-ant-1.8.3\lib\ant-apache-oro.jar
    [junit] C:\Java\apache-ant-1.8.3\lib\ant-apache-regexp.jar
    [junit] C:\Java\apache-ant-1.8.3\lib\ant-apache-resolver.jar
    [junit] C:\Java\apache-ant-1.8.3\lib\ant-apache-xalan2.jar
    [junit] C:\Java\apache-ant-1.8.3\lib\ant-commons-logging.jar
    [junit] C:\Java\apache-ant-1.8.3\lib\ant-commons-net.jar
    [junit] C:\Java\apache-ant-1.8.3\lib\ant-jai.jar
    [junit] C:\Java\apache-ant-1.8.3\lib\ant-javamail.jar
    [junit] C:\Java\apache-ant-1.8.3\lib\ant-jdepend.jar
    [junit] C:\Java\apache-ant-1.8.3\lib\ant-jmf.jar
    [junit] C:\Java\apache-ant-1.8.3\lib\ant-jsch.jar
    [junit] C:\Java\apache-ant-1.8.3\lib\ant-junit.jar
    [junit] C:\Java\apache-ant-1.8.3\lib\ant-junit4.jar
    [junit] C:\Java\apache-ant-1.8.3\lib\ant-launcher.jar
    [junit] C:\Java\apache-ant-1.8.3\lib\ant-netrexx.jar
    [junit] C:\Java\apache-ant-1.8.3\lib\ant-swing.jar
    [junit] C:\Java\apache-ant-1.8.3\lib\ant-testutil.jar
    [junit] C:\Java\apache-ant-1.8.3\lib\ant.jar
    [junit] C:\Java\jdk1.6.0_31_x86\lib\tools.jar
    [junit] ------------- ---------------- ---------------
    [junit]
    [junit] Testcase: dummyTest took 0.005 sec

And here is the one of 'mvn test'

Running test.DummyTest
D:\tmp\1\MavenTest\target\test-classes
D:\tmp\1\MavenTest\target\classes
C:\Users\urs2\.m2\repository\junit\junit\4.8\junit-4.8.jar
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.045 sec

Please, find the example attached.
Thanks, Alex.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 53049] Classpath entries passed to a junit task don't get received by jUnit test classes

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53049

Stefan Bodewig <bo...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Stefan Bodewig <bo...@apache.org> ---
the system propery java.class.path doesn't tell you anything about the
classloader that was used.  If you'd fork the junit task you'd see all you
expect.

For a non-forked execution you'll get a real answer by

        String classPath = ((org.apache.tools.ant.AntClassLoader)
DummyTest.class.getClassLoader()).getClasspath();

-- 
You are receiving this mail because:
You are the assignee for the bug.

DO NOT REPLY [Bug 53049] Classpath entries passed to a junit task don't get received by jUnit test classes

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53049

AlexAD <a3...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |a320395040@gmail.com
   Target Milestone|---                         |1.8.3
         OS/Version|                            |All

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.