DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19099>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19099

[PATCH] add resultproperty support to <java>

           Summary: [PATCH] add resultproperty support to <java>
           Product: Ant
           Version: 1.6Alpha (nightly)
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Core tasks
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


I have an attachment, but can't see where to attach it.

I use 3rd party java software that returns -1 whenever it issues a warning.
These warnings are harmless. Whenever an error occurs -2 is returned. To make
the build fail on real problems it is necessary to catch the exit code. This
patch takes the resultproperty code from the <exec> task and grafts it onto the
<java> task. Exit code can only be non zero when failonerror=false and when
fork=true.

Here is an example on how to use it.

     <java classname="test.Main"
           fork="true"
           failonerror="false"
           resultproperty="exitcode"
           >
     </java>
     <condition property="good.build">
       <or>
         <equals arg1="${exitcode}" arg2="0" />
         <equals arg1="${exitcode}" arg2="-1" />
       </or>
     </condition>
     <fail unless="good.build"
           message="Unexpected exit code: exitcode = ${exitcode}"/>

Reply via email to