I'm getting the below exception when attempting to run the class org.apache.tools.ant.launch.Launcher which comes as part of the ant launcher jar :
testTask: [java] Working directory ignored when same JVM is used.
[java] Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre1.8.0_141\lib\tools.jar
[java] java.lang.ClassCastException: org.apache.tools.ant.Main cannot be cast to org.apache.tools.ant.launch.AntMain
[java] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:256)
[java] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[java] at java.lang.reflect.Method.invoke(Unknown Source)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:217)
[java] at java.lang.Thread.run(Unknown Source)
This is the ant target I'm running:
<target name="testTask">
<java classname="org.apache.tools.ant.launch.Launcher" failonerror="true" jvm="C:/jdk1.8.0_141-x64/bin/java" dir=".">
<classpath>
<pathelement location="ant-launcher-1.7.0.jar"/>
<pathelement location="ant-1.7.0.jar"/>
</classpath>
</java>
</target>
and if you look inside ant-1.7.0.jar inside the classpath, you will find that org.apache.tools.ant.Main in fact implements org.apache.tools.ant.launch.AntMain:
and inside ant-launcher-1.7.0.jar, org.apache.tools.ant.launch.AntMain exists exactly under the package we're looking for:
Also I made sure that org.apache.tools.ant.Main overrides the method startAnt(String[] paramArrayOfString, Properties paramProperties, ClassLoader paramClassLoader) and takes the same arguments.
The line causing this exception is:
mainClass = Class.forName("org.apache.tools.ant.Main");
AntMain main = (AntMain)mainClass.newInstance();
worth noting that if I create the exact same class as org.apache.tools.ant.Main but rename it and place it on its own (outside of any .jar package), and run the above snippet but using the name of the new class it works perfectly fine.
Why is java insisting that org.apache.tools.ant.Main cannot be cast to org.apache.tools.ant.launch.AntMain ?
Related
I am writing an ant task which uses below code :
public class Klazz extends Task{
public void execute() throws BuildException{
HtmlUnitDriver driver = new HtmlUnitDriver();
driver.get("file:///C:/sample/alltests-fails.html");
}
In eclipse the project named is "test-project" and used "libs" folder which contains the jars (ant.jar, selenium-server-standalone-2.44.0.jar) to be added in the classpath . If I run the code in Eclipse its working fine but while running as an ant task it throws java.lang.ExceptionInInitializerError . Below is the build.xml snippet to create the jar(named custom-task.jar) file which needs to be put in the %ant_home%\lib folder.
<target name="jar" depends="compile" >
<mkdir dir="build/jar" />
<jar destfile="${env.ANT_HOME}/lib/custom-task.jar">
<fileset dir="build/classes" />
<restrict>
<name name="**/*.class" />
<archives>
<zips>
<fileset dir="${basedir}/libs/" includes="**/*.jar" />
</zips>
</archives>
</restrict>
</jar>
</target>
May be the external jars/classes not added properly in the class path while creating the jar through the "jar" task above, resulting some missing class files causing the ExceptionInInitializerError.
Advance thanks for any help on this .
below is the stack trace :
java.lang.ExceptionInInitializerError
at org.cyberneko.html.HTMLScanner.scanEntityRef(HTMLScanner.java:1415)
at org.cyberneko.html.HTMLScanner$ContentScanner.scan(HTMLScanner.java:2
059)
at org.cyberneko.html.HTMLScanner.scanDocument(HTMLScanner.java:920)
at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:499
)
at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:452
)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.pars
e(HTMLParser.java:926)
at com.gargoylesoftware.htmlunit.html.HTMLParser.parse(HTMLParser.java:2
45)
at com.gargoylesoftware.htmlunit.html.HTMLParser.parseHtml(HTMLParser.ja
va:191)
at com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(Defau
ltPageCreator.java:268)
at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPa
geCreator.java:156)
at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient
.java:455)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:329)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:394)
at org.openqa.selenium.htmlunit.HtmlUnitDriver.get(HtmlUnitDriver.java:4
77)
at org.openqa.selenium.htmlunit.HtmlUnitDriver.get(HtmlUnitDriver.java:4
66)
at mypkg.Klazz.execute(Klazz.java:15)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
cutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.Main.runBuild(Main.java:851)
at org.apache.tools.ant.Main.startAnt(Main.java:235)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: java.lang.NullPointerException
at java.util.Properties$LineReader.readLine(Properties.java:434)
at java.util.Properties.load0(Properties.java:353)
at java.util.Properties.load(Properties.java:341)
at org.cyberneko.html.HTMLEntities.load0(HTMLEntities.java:101)
at org.cyberneko.html.HTMLEntities.<clinit>(HTMLEntities.java:53)
... 33 more
Total time: 2 seconds
Should there have been any class loading difficulties, I would assume a NoClassDefFoundError or a ClassNotFoundException would occur
The ExceptionInInitializerError is usually not what should draw attention, because it only says "Hey, programmer, an exception happened inside an initialization block"
More about initialization blocks here
Therefore, dealing with the NPE will fix the issue, but unfortunately I've no access to the code that could've caused this. Let me know and I shall edit the answer.
#Vlad Ilie thanks for having a look , its solved now.. the problem is with jar creation ant script .
The earlier ant task for the jar creation is not able to club all the jars in the class path and resulting... classnotfoundexception which in turn caused the ExceptionInInitializerError and NullPointerException .
Below is the fixed "jar" task which is successfully able to add all the jars in the class path .
<target name="jar" depends="compile">
<jar destfile="${env.ANT_HOME}/lib/custom-task.jar" basedir="build/classes" >
<zipgroupfileset dir="${basedir}/libs/" includes="*.jar"/>
</jar>
</target>
Above I used zipgroupfileset which is very handy .
After upgrading to Dojo 1.7.3, our ant build that was working flawlessly for years on previous versions of Dojo is now completely non-operational due to out of memory errors:
[java] starting writing resources...
[java] java.lang.OutOfMemoryError: GC overhead limit exceeded
[java] at org.mozilla.javascript.Interpreter.getArgsArray(Interpreter.java:4623)
[java] at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3335)
[java] at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2484)
[java] at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
[java] at org.mozilla.javascript.NativeArray.iterativeMethod(NativeArray.java:1565)
[java] at org.mozilla.javascript.NativeArray.execIdCall(NativeArray.java:313)
[java] at org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:127)
[java] at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3335)
[java] at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2484)
[java] at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
[java] at org.mozilla.javascript.ScriptRuntime.applyOrCall(ScriptRuntime.java:2347)
[java] at org.mozilla.javascript.BaseFunction.execIdCall(BaseFunction.java:272)
[java] at org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:127)
[java] at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:76)
[java] at org.mozilla.javascript.gen.c1._c62(Unknown Source)
[java] at org.mozilla.javascript.gen.c1.call(Unknown Source)
[java] at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:97)
[java] at org.mozilla.javascript.gen.c1._c69(Unknown Source)
[java] at org.mozilla.javascript.gen.c1.call(Unknown Source)
[java] at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:97)
[java] at org.mozilla.javascript.gen.c1._c40(Unknown Source)
[java] at org.mozilla.javascript.gen.c1.call(Unknown Source)
[java] at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:97)
[java] at org.mozilla.javascript.gen.c1._c42(Unknown Source)
[java] at org.mozilla.javascript.gen.c1.call(Unknown Source)
[java] at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3335)
[java] at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2484)
[java] at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
[java] at org.mozilla.javascript.ScriptRuntime.applyOrCall(ScriptRuntime.java:2347)
[java] at org.mozilla.javascript.BaseFunction.execIdCall(BaseFunction.java:272)
[java] at org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:127)
[java] at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:76)
[java] js: exception from uncaught JavaScript throw: java.lang.OutOfMemoryError: GC overhead limit exceeded
I have extensively documented our troubles here.
In particular, where I note:
If I run my build straight from the CL as a Java command, with the '
--optimize shrinksafe" switch, it fails, but without it succeeds. (running it with internStrings alone seems to cause other errors).
Not sure what to make of this, since I believe that oprtimize defaults
to shrinksafe, but I have determined the following:
WORKS:
c:\temp\dojo-release-1.7.3rc1-src\util\buildscripts>java -Xms256m
-Xmx256m -cp ../shrinksafe/js.jar;../closureCompiler/compiler.jar;../shrinksafe/shrinksafe.jar
org.mozilla.javascript.tools.shell.Main ../../dojo/dojo.js
baseUrl=../../dojo load=build -p
C:\company\builds\head\build\generated\general\comComplete.profile.js
--action release --releaseDir C:\company\builds\head\build\generated\general\htdocs\company\javascript\1420
BROKEN (out of memory errors):
c:\temp\dojo-release-1.7.3rc1-src\util\buildscripts>java -Xms256m
-Xmx256m -cp ../shrinksafe/js.jar;../closureCompiler/compiler.jar;../shrinksafe/shrinksafe.jar
org.mozilla.javascript.tools.shell.Main ../../dojo/dojo.js
baseUrl=../../dojo load=build -p
C:\company\builds\head\build\generated\general\comComplete.profile.js
--action release --releaseDir C:\company\builds\head\build\generated\general\htdocs\company\javascript\1420
--optimize shrinksafe --internStrings true
Unfortunately, the following ant script target continues to fail with
memory errors:
BuildNum: ${buildNum}
<path id="js.path"> <pathelement location="${basedir}"/>
</path>
<pathconvert targetos="unix" property="js.path.unix" refid="js.path"
/> js.path.unix: ${js.path.unix}
<!-- clean unpack and output dirs --> <delete
dir="${outputDir}/htdocs/company/javascript/src/" />
<copy file="${externalDir}/dojo/companyComplete.profile.js"
tofile="${outputDir}/companyComplete.profile.js" filtering="yes"
overwrite="yes">
<java fork="true"
dir="${outputDir}/htdocs/company/javascript/src/util/buildscripts"
classname="org.mozilla.javascript.tools.shell.Main"
failonerror="true">
-->
--> --> -->
Update 1
I've also tried it with:
<jvmarg value="-Xms5120m"/>
<jvmarg value="-Xmx5120m"/>
And also using the maxmemory setting on the ant java task itself.
Finally found the problem, the releaseDir switch value had both windows and unix file separators in it. That used to work fine in Dojo < 1.6 and typically Java has no problem with it. For some reason, the Dojo 1.7 build system hits memory problems in that case.
The releaseDir, after resolving the ant tokens from the question, had a mix of both unix and windows file separators:
<arg value="releaseDir=${output.dir}/path/foo/bar" />
-> Became ->
releaseDir=blah\blah\blah/path/foo/bar
And that was enough to cause the build to lock up at 'writing resources' and then crash with 'out of heap space'. (This is something Java normally handles without issue).
The fix was simple enough:
<path id="dojo.output.tmp">
<pathelement location=" ${output.dir}/path/foo/bar "/>
</path>
<pathconvert targetos="unix" property="dojo.output.dir" refid="dojo.output.tmp" />
...
<arg value="releaseDir=${dojo.output.dir}" />
I've added a Web Service using Axis2 to my project and now I can't run my application.
This is the classpath I am using:
<property name="classpath" location="bin:EventReservationCore/bin:EventReservationCore/db:EventReservationCore/lib/*:EventReservationCore/lib/util_iso2.jar:EventReservationCore/lib/sqlitejdbc-v056.jar:AuthorizationRMI/lib/AuthorizationService.jar:EventReservationCore/lib/activemq-all-5.4.3.jar:/home/ander/axis2-1.6.1/webapp/axis2.war"/>
And this is the target that runs until I add the Axis2 Web Service.
<target name="run.besocial">
<java classname="eventReservationServer.ReservationEventServer" classpath="${classpath}" fork="true">
<jvmarg value="-Djava.rmi.server.codebase=file:EventReservationCore/bin/ file:EventReservationCore/lib/util_iso2.jar"/>
<jvmarg value="-Djava.security.policy=EventReservationCore/java.policy" />
</java>
</target>
As a result I get this error:
[java] Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/axis2/client/Stub
[java] at java.lang.ClassLoader.defineClass1(Native Method)
[java] at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
[java] at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
[java] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
[java] at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
[java] at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
[java] at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
[java] at java.security.AccessController.doPrivileged(Native Method)
[java] at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
[java] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
[java] at eventReservationServer.eventServerGateway.WSEventServerGateway.getEvents(WSEventServerGateway.java:19)
[java] at eventReservationServer.ReservationEventServer.<init>(ReservationEventServer.java:101)
[java] at eventReservationServer.ReservationEventServer.main(ReservationEventServer.java:130)
[java] Caused by: java.lang.ClassNotFoundException: org.apache.axis2.client.Stub
[java] at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
[java] at java.security.AccessController.doPrivileged(Native Method)
[java] at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
[java] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
[java] ... 15 more
If you are using tomcat, copy all the jar files located under axis2/lib folder to the tomcat/lib folder and also add them to the classpath like this D:\axis2-1.6.2\lib*
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/axis2/client/Stub
Above error can be removed by adding axis2-kernel-1.6.2 to the class path, but you might start getting other errors after you have generated the stubs with wsdl2java.bat.
So you better add all the axis2-jars to classpath while compiling the client.
Hope this helps
None of the answers helped me. Here is then what I did.
I used eclipse to generate Runnable Jar(right click->Export->Runnable Jar) with all the libraries added as package.
It gave me a JAR that I could run from command line.
Then I did diff between Jar from eclipse and Jar that my build created. I was able to find the missing dependencies that my build was not putting in Jar.
If you faced the same issue for JBoss class loader, follow the tips on here and here.
The most important part is to define a new module in JBoss module configurations, and also locate the module in you MANIFEST.MF file.
Maven will help you to do the later part. Following is a sample configuration to add axis module to your Manifest file.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
<configuration>
<archive>
<manifestEntries> <!--Manually added JBoss Modules (that are not found by JBoss class loader) must be loaded here-->
<Dependencies>axis.axis</Dependencies>
</manifestEntries>
</archive>
</configuration>
</plugin>
Depending to your packaging type, you would use other maven plugins like maven-jar-plugin or maven-war-plugin.
The dependency package name must match the name that you have specified to your module name in JBoss modules. The above axis module is defined in JBoss models as explained in the links above.
<module xmlns="urn:jboss:module:1.1" name="axis.axis">
<properties>
<property name="jboss.api" value="private"/>
</properties>
<!-- ... -->
</module>
I am trying to compile and run a simple java class within eclipse. The compile task works fine, and since I do not specify a destination folder the build files are in the same directory as the source. Which is alright, at the moment all I need is to learn how I can run the class with the main() method.
I have tried using the fully qualified name of the class (with package name, etc) and the classname alone, but always I get a java.lang.ClassNotFoundException
Buildfile: C:\Users....\build.xml
run:
[java] java.lang.NoClassDefFoundError: code/control/MyClass
[java] Caused by: java.lang.ClassNotFoundException: code.control.MyClass
[java] at java.net.URLClassLoader$1.run(Unknown Source)
[java] at java.security.AccessController.doPrivileged(Native Method)
[java] at java.net.URLClassLoader.findClass(Unknown Source)
[java] at java.lang.ClassLoader.loadClass(Unknown Source)
[java] at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
[java] at java.lang.ClassLoader.loadClass(Unknown Source)
[java] at java.lang.ClassLoader.loadClassInternal(Unknown Source)
[java] Could not find the main class: code.control.MyClass. Program will exit.
[java] Exception in thread "main"
[java] Java Result: 1
compile:
default:
BUILD SUCCESSFUL
Total time: 234 milliseconds
Below, are the targets taken from my build.xml file:
<target name="default" depends="compile" description="learn">
</target>
<target name="compile" depends="run">
<javac srcdir="src/" />
</target>
<target name="run">
<java classname="code.control.MyClass" fork="true"/>
</target>
I can't figure out why the class is not found. MyClass contains the main() method and since i specify no classpath it should look at the current directory, which is the src/ right?
The development directory is the usual eclipse file structure:
projectName/src/code/control/MyClass
If it is a classpath problem how could I resolve it? I always had problem grasping the concept "put it on your classpath" ... If someone could provide a little bit of explanation with the classpath in the ant context, I would be very thankful.
Thanks for any help on this. The version of ant is 1.7.0
The classpath is where the Java runtime looks for your .class files, similar to how your OS uses the PATH variable to find executables.
Try this in your build script:
<target name="run">
<java fork="true" classname="code.control.MyClass">
<classpath>
<path location="src/"/>
</classpath>
</java>
There's a HelloWorld version for ant that walks through building a Java program with ant.
you should include classpath, e.g.
<java classpath="${bin}" classname="code.control.MyClass">
where ${bin} is your output folder.
change your build.xml as below and try out:
<target name="default" depends="run" description="learn">
</target>
<target name="compile" >
<javac srcdir="src/" />
</target>
<target name="run" depends="compile">
<java classname="code.control.MyClass" fork="true"/>
</target>
I'm running CrossCheck (browserless js unit testing) as part of an ant script. I'd like ant to report failure if the CrossCheck tests fail. Here's the relevant bit from the build.xml
<target name="test" depends="concat">
<java jar="src/test/lib/crosscheck.jar" fork="true">
<arg value="src/test/webapp/js/"/>
</java>
And an example of CrossCheck's failure messaging:
[java] Running tests in environment: Mozilla 1.7 (Firefox 1.0)
[java] org.mozilla.javascript.EcmaError: ReferenceError: "clusterNode" is not defined. (ResultXMLWrapperTest.js#22)
[java] at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3229)
[java] at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3219)
[java] at org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3292)
[java] at org.mozilla.javascript.ScriptRuntime.nameOrFunction(ScriptRuntime.java:1636)
[java] at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1575)
[java] at org.mozilla.javascript.gen.c1._c1(ResultXMLWrapperTest.js:22)
[java] at org.mozilla.javascript.gen.c1.call(ResultXMLWrapperTest.js)
[java] at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:340)
[java] at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2758)
[java] at org.mozilla.javascript.gen.c1.call(ResultXMLWrapperTest.js)
[java] at net.thefrontside.crosscheck.framework.AbstractScopeFactory$1.run(AbstractScopeFactory.java:108)
[java] at org.mozilla.javascript.Context.call(Context.java:515)
[java] at org.mozilla.javascript.Context.call(Context.java:450)
[java] at net.thefrontside.crosscheck.framework.AbstractScopeFactory.initTestScope(AbstractScopeFactory.java:94)
[java] at net.thefrontside.crosscheck.framework.DefaultScopeFactory.getTestScope(DefaultScopeFactory.java:68)
[java] at net.thefrontside.crosscheck.framework.TestCase$1.run(TestCase.java:119)
[java] at org.mozilla.javascript.Context.call(Context.java:528)
[java] at org.mozilla.javascript.Context.call(Context.java:450)
[java] at net.thefrontside.crosscheck.framework.TestCase.run(TestCase.java:117)
[java] at net.thefrontside.crosscheck.framework.TestSuite.run(TestSuite.java:95)
[java] at net.thefrontside.crosscheck.framework.Crosscheck.runAll(Crosscheck.java:116)
[java] at net.thefrontside.crosscheck.framework.ConsoleRunner.run(ConsoleRunner.java:140)
[java] at net.thefrontside.crosscheck.framework.ConsoleRunner.main(ConsoleRunner.java:300)
[java] ReferenceError: "clusterNode" is not defined. (ResultXMLWrapperTest.js#22)
[java] Java Result: 1
Can ant get at the results of the CrossCheck test (perhaps Java Result: 1 gets passed back to ant?) and succeed or fail based on that?
Assuming that CrossCheck returns a non-zero return code on a error you could add the failonerror attribute to the java task:
<target name="test" depends="concat">
<java jar="src/test/lib/crosscheck.jar" fork="true" failonerror="true">
<arg value="src/test/webapp/js/"/>
</java>
See the documentation on the Ant java task.
You can use the 'failonerror' attribute of the 'java' task.
failonerror Stop the buildprocess if
the command exits with a returncode
other than 0. Default is "false" (see
note)
Check the Ant manual here.