You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Rebhan, Gilbert" <Gi...@huk-coburg.de> on 2005/08/17 09:58:04 UTC

BuildFailed if ReturnCode 1 ?!

Hi,

i've written a java class that is called in my buildscript.
That class requieres 3 args.

In the code of my class i've written :

if (args.length < 3) {
            System.out.println("***Error *** .... ");
        System.exit(1);

In a little testscript i've tried with =

<target name="parseLogs">
<java classname="de. ...">
	<!-- arg [0-->
	<arg value="c:/backup_cclogs" />
	<classpath>
	<pathelement location="C:/ant_extralibs/myant.jar" />
	</classpath>
</java>
</target>
	
<target name="default" depends="parseLogs">
<echo message="parseCCLogs successful"></echo>
</target>

I expected to get a BuildFailed as args[1] and args[2] are missing, 
but i got my ***Error*** ... message and a 

Build Successful combined with an

[java] org.eclipse.ant.internal.ui.antsupport.AntSecurityException
...

How to ensure a BuildFailed if the required args[] for my class
are not properly set ?! 


Gilbert

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: BuildFailed if ReturnCode 1 ?!

Posted by Steve Loughran <st...@apache.org>.
Rebhan, Gilbert wrote:
> Hi,
> 
> i've written a java class that is called in my buildscript.
> That class requieres 3 args.
> 
> In the code of my class i've written :
> 
> if (args.length < 3) {
>             System.out.println("***Error *** .... ");
>         System.exit(1);
> 
> In a little testscript i've tried with =
> 
> <target name="parseLogs">
> <java classname="de. ...">
> 	<!-- arg [0-->
> 	<arg value="c:/backup_cclogs" />
> 	<classpath>
> 	<pathelement location="C:/ant_extralibs/myant.jar" />
> 	</classpath>
> </java>
> </target>
> 	
> <target name="default" depends="parseLogs">
> <echo message="parseCCLogs successful"></echo>
> </target>
> 
> I expected to get a BuildFailed as args[1] and args[2] are missing, 
> but i got my ***Error*** ... message and a 
> 
> Build Successful combined with an
> 
> [java] org.eclipse.ant.internal.ui.antsupport.AntSecurityException
> ...
> 
> How to ensure a BuildFailed if the required args[] for my class
> are not properly set ?! 

set failonerror=true to have non-zero return codes mapped to build errors

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org