Summary: | <junit> task should work so long as junit.jar present in <classpath> even if not among Ant libs | ||
---|---|---|---|
Product: | Ant | Reporter: | Jesse Glick <jglick> |
Component: | Optional Tasks | Assignee: | Ant Notifications List <notifications> |
Status: | RESOLVED FIXED | ||
Severity: | major | CC: | ant, dk, johnny_hujol, martin.moorhead, mpetras, notifications, pete.cant |
Priority: | P2 | ||
Version: | 1.3 | ||
Target Milestone: | 1.7.0 | ||
Hardware: | All | ||
OS: | All | ||
Bug Depends on: | |||
Bug Blocks: | 6606 | ||
Attachments: |
Working patch
Manual test case |
Description
Jesse Glick
2006-02-27 20:38:21 UTC
Created attachment 17802 [details]
Working patch
Does not include docs, WHATSNEW, @since, etc. Needs further testing, possibly
refinement.
*** Bug 1118 has been marked as a duplicate of this bug. *** *** Bug 7081 has been marked as a duplicate of this bug. *** *** Bug 14931 has been marked as a duplicate of this bug. *** *** Bug 33440 has been marked as a duplicate of this bug. *** *** Bug 36862 has been marked as a duplicate of this bug. *** Created attachment 17805 [details]
Manual test case
Tries various combinations of options:
1. Ant 1.6.5 vs. patched Ant 1.7.
2. JUnit 3 vs. 4.
3. junit.jar in $CLASSPATH or not.
4. junit.jar in <classpath> or not.
5. fork="true" vs. fork="false".
6. Custom <formatter> or not.
Some paths hardcoded at top of file.
revision 381467 Let's see if any regressions are found. Also tested successfully inside NetBeans IDE 5.0, to make sure the same fix works even inside a container with its own class loaders etc. Had to install a module containing a JAR entry ---%<---META-INF/services/org.apache.tools.ant.module.spi.AutomaticExtraClasspathProvider #-org.netbeans.modules.junit.JUnitClasspathProvider ---%<--- which suppresses the IDE's normal inclusion of junit.jar into the Ant classpath. Then when running without -J-Xverify:none (which sometimes makes even 1.6.5 work, if it happens not to try to load any junit.** classes), Ant 1.6.5 inside the IDE fails on a plain Java project with unit tests but patched 1.7 succeeds, incl. with JUnit 4. Excellent. This has been a big annoyance for a lot of people. > Note that since both "halves" of the task remain in > the same source root, the compiler does not enforce the > separation - a full fix would move the junit.jar-dependent > classes to a separate source root You could use jdepend to enforce the separation. (http://clarkware.com/software/JDepend.html) |