ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jonathan_cu...@bankone.com
Subject RE: question regarding WSAD specific ant tasks
Date Wed, 04 Jun 2003 14:19:32 GMT

Also, in order to make the <fail> task work with the "unless" attribute, I
had to upgrade the version of ant supplied with WSAD 5.0.  I upgraded from
Ant 1.4.1 to Ant 1.5.3.  Alex's solution should not require the update to
be performed.

Jon Culli

Senior Developer
Bank One (http://www.bankone.com)
Phone: 1-312-661-6354





jonathan_culli@bankone.com on 06/04/2003 08:59:42 AM

Please respond to "Ant Users List" <user@ant.apache.org>

To:   "Ant Users List" <user@ant.apache.org>
cc:

Subject:  RE: question regarding WSAD specific ant tasks




I was browsing the list archives and found another way to utilize the fail
tast to terminate the build when compile errors occur.  It's really not a
pretty way to do things, but it does stop the build when necessary.

<target name="jar_credit1utils" >

          <eclipse.refreshLocal resource="${common_project}" />

          <projectBuild ProjectName="${common_project}" failonerror="true"
DebugCompilation="true" BuildType="full" />

          <getJavacErrorCount ProjectName="${common_project}" PropertyName
="MyJavacErrorCount" />

          <echo message="MyJavacErrorCount=${MyJavacErrorCount}" />

          <!-- create a property based on the number of compile time
errors.  This slick nastiness is
                 necessary because projectBuild does not terminate when
compile errors are encountered
                 regardless of the value of the failonerror attribute. -->
          <property name="javaErrors${MyJavacErrorCount}" value="foo" />

          <!-- this echoes the name of the property created based on the
number of compile errors from projectBuild -->
          <echo message="javaErrors${MyJavacErrorCount}" />

          <!-- the build fails unless a property named javaErrors0 has been
created, signifying a clean java compile -->
          <fail unless="javaErrors0" message="Build Failed due to
${MyJavacErrorCount} compile errors." />

          <utilJar EARProjectName="${ear_project}" JavaProjectName="
${common_project}" Jar="./lib/credit1utils.jar" />

</target>


Jon Culli

Senior Developer
Bank One (http://www.bankone.com)
Phone: 1-312-661-6354





"North Alex" <Alex.North@tapiola.fi> on 06/04/2003 02:34:55 AM

Please respond to "Ant Users List" <user@ant.apache.org>

To:   "Ant Users List" <user@ant.apache.org>
cc:

Subject:  RE: question regarding WSAD specific ant tasks



>My question is regarding behavior of the <projectBuild> task
>when there is at least one compile error present.  The
><projectBuild> task is not failing or terminating when there
>is a compile error present regardless of the value of the
>"failonerror" attribute.  I get a "BUILD SUCCESSFUL" message
>after the task even though compile problems are noted in the
>trace.  Is this the expected behavior or am I somehow missing
>something?

I came across the same problem (running inside WSAD 5) ... here is my
solution:

<target name="do.compile" depends="clean">
    <projectBuild ProjectName="${component.name}" failonerror="true"
          DebugCompilation="true" BuildType="full"/>

    <getJavacErrorCount ProjectName="${component.name}"
        PropertyName="compile.error.count" />
    <condition property="build.ok">
        <equals arg1="${compile.error.count}" arg2="0"/>
    </condition>
</target>

<target name="fail.build.check" unless="build.ok">
  <fail>Failed while compiling ${component.name}</fail>
</target>

<target name="Compile" depends="do.compile, fail.build.check">
</target>


If there is a nicer way to do this, I'd like to know.

<= Alex =>

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









This transmission may contain information that is privileged, confidential
and/or exempt from disclosure under applicable law. If you are not the
intended recipient, you are hereby notified that any disclosure, copying,
distribution, or use of the information contained herein (including any
reliance thereon) is STRICTLY PROHIBITED. If you received this transmission
in error, please immediately contact the sender and destroy the material in
its entirety, whether in electronic or hard copy format. Thank you.


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









This transmission may contain information that is privileged, confidential and/or exempt from
disclosure under applicable law. If you are not the intended recipient, you are hereby notified
that any disclosure, copying, distribution, or use of the information contained herein (including
any reliance thereon) is STRICTLY PROHIBITED. If you received this transmission in error,
please immediately contact the sender and destroy the material in its entirety, whether in
electronic or hard copy format. Thank you.


Mime
View raw message