|
Davy this behaviour seems like a classpath issue problem. It turns out that when I have something that had been built other version of ant (different than 1.7.0) and you try to build it with the new version of Ant it complains. The real solution is to just ensure you have cleaned everything with
ant clean and then try building it with ant. HTH No, I don't think I had a local classpath issue because I
did the following in DOS: 1. set CLASSPATH= 2. set ANT_HOME= 3. download and unzip fresh copy of Jakarta Cactus 13-1.7.2 4. download and unzip fresh copy of Apache ANT 1.6.5 5. download and unzip fresh copy of Apache ANT 1.7.0 6. go to the subfolder samples/ejb of Jakarta Cactus and type: 6.1 set ANT_HOME=...home of fresh Apache ANT 1.6.5 ... 6.2 %ANT_HOME%\bin\ant -version ---> 1.6.5 OK 6.3 %ANT_HOME%\bin\ant clean test ...\samples\ejb\build.xml:134: taskdef A class needed by class org.apache.cactus.integration.ant.CactusTask cannot be found: junit/framework/Test So junit not found. 6.4 copy junit-3.8.1.jar to %ANT_HOME%\lib 6.5 %ANT_HOME%\bin\ant clean test ---> OK 7. go to the subfolder samples/ejb of Jakarta Cactus and type: 7.1 set ANT_HOME=...home of fresh Apache ANT 1.7.0 ... 7.2 %ANT_HOME%\bin\ant -version ---> 1.7.0 OK 7.3 %ANT_HOME%\bin\ant clean test ---> NOK BUILD FAILED java.lang.NoSuchMethodError: org.apache.cactus.integration.ant.CactusTask. addClasspathEntry(Ljava/lang/String;)V Remarks : - I tried it with JDK 1.4 and JDK 1.5, but both show the same behaviour - when using ANT 1.6.5, the jar junit 3.8.1 must be copied to %ANT_HOME%\lib, because otherwise the following error message appears : ...\samples\ejb\build.xml:134: taskdef A class needed by class org.apache.cactus.integration.ant.CactusTask cannot be found: junit/framework/Test With ANT 1.7.0, I didn't get this error message, but perhaps this is because this error message appears only after the following error message: BUILD FAILED java.lang.NoSuchMethodError: org.apache.cactus.integration.ant.CactusTask. addClasspathEntry(Ljava/lang/String;)V Hi all,
I could reproduce the error following the previous instructions from Davy on Cactus 1.7.2. When I tried on the SVN code, it worked fine if I hadn't defined any server. But once I tried to run the tests against Tomcat, I got the same issue, even applying the supplied path. I think we have 2 options: upgrade Ant dependency to 1.7.0 or write some wrapping code that calls the right method (that would be an ugly hack). Petar, could you check with the Ant guys what would be the 'official' recommendation (if any) for this issue? -- Felipe Has there been any progress on this issue?
I suspect you'll need to support both Ant 1.6 and 1.7 simultaneously. Why not do something like? Leave org.apache.cactus.integration.ant.CactusTask alone (link it against Ant 1.6) Create org.apache.cactus.integration.ant.Ant17CactusTask (link it against Ant 1.7) Create a series of parallel tasks <ant17cactus> <ant17cactifywar> etc. When switching to Ant 1.7, consumers would need to change from <cactus> to <ant17cactus> etc. OK, I admit, slightly hokey and clumsy, but it gets the job done. I've been waiting for a resolution, but would be satisfied with a "We'll address this in version X" statement. An alternative (and cleaner) proposal:
Change CactusTask such that it holds an instance of Ant 1.7 and an Ant 1.6 task. Modify it such that rather than extending, it delegates (to 1.6 by default, but an optional argument "ant_version=1.7" can cause it to delegate otherwise). Upgrading then consists of changing <cactus> to <cactus ant_version=1.7> Or even cleaner:
Change CactusTask such that it holds an instance of Ant 1.7 and an Ant 1.6 task. Modify it such that rather than extending, it delegates depending on the Java environment property ${ant.version}. This way you shouldn't add the attribute "ant_version=1.7" to <cactus>. For those not so familiar with the cactus sources:
Please note that the patch should be applied to the build.xml file in the integration/ant directory. Cactus works with Ant 1.7.1 but cannot work with Ant 1.7.0.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Thank you for pointing this.
I also noticed this problem with one of the first BETA versions of Apache ANT 1.7, but I decided to wait till the official release of ANT 1.7. Here I am attaching a patch that solves the issue.