Why isn't the param value being "scoped"? I was under the impression that an
<antcall> encapsulates all the properties associated with the target being
called (unless inheritAll="false") including any properties that were set in
depends target calls. I've tried several different ways to get the build
logic to flow a certain way but each iteration (after failing to achieve
desired results) becomes more of a hack (and messy)...this way appeared to
be the cleanest way but it doesn't work as planned.
What I noticed was that the <param name="jndiPrefix" value="aux" /> was not
being set when the depends call to chk-ejbjndi-outofdate target was
executed. This compounds my confusion, how does the <outofdate> task execute
when the ${jndiPrefix} property is not resolved?
I know this because of the debug output:
chk-ejbjndi-outofdate:
Property ${jndiPrefix} has not been set
The chain of events starts at the generate.ejb.jars target. Any insight will
be greatly appreciated.
<target name="chk-ejbjndi-outofdate">
<outofdate property="jndi_outofdate">
<sourcefiles>
<fileset dir="${this.ejb.build.dir}" includes="**/*.class"/>
</sourcefiles>
<targetfiles>
<pathelement
path="${app.module.dir}\${jndiPrefix}\${ejb.jar.name}"/>
</targetfiles>
</outofdate>
<echo>${jndiPrefix} notuptodate: ${jndi_outofdate}</echo>
</target>
<target name="ejb.jar.prefix" depends="chk-ejbjndi-outofdate"
if="jndi_outofdate">
<antcall target="ejb.jar">
<param name="jndiPrefix" value="aux" />
</antcall>
<antcall target="ejb.jar">
<param name="jndiPrefix" value="rules" />
</antcall>
<antcall target="ejb.jar">
<param name="jndiPrefix" value="complexRules" />
</antcall>
</target>
<target name="generate.ejb.jars" depends="init,jarTmpEJB,compile">
<!-- Generate different ejb jar base on jndi prefix. -->
<antcall target="ejb.jar.noprefix"/>
<antcall target="ejb.jar.prefix"/>
...
</target>
Thanks
-----Original Message-----
From: Lopez, William
Sent: Thursday, July 31, 2003 12:04 AM
To: 'Ant Users List'
Subject: Conditional (compound) Help Please
I have a need for a task that compares a jar to it's "list" of class files
(found uptodate to work fine for the first part of the compare).
I expect the second compare to never be true when the first is (*to meet the
target execute condition*). The <not> part is not working like I thought (as
a negator)...I tried the <outofdate> task but it always ends up executing
the target...see below, 2nd example.
My scenario:
-There is another task that executes unless="noprefix_uptodate"....this
generates/deploys the ejb jar for the non-jndi prefix ejb -Then ejb.jar is
called (via <antcall> 3x - 1 per other jndi prefixes)...the only difference
between these jars is the jndi prefix
I'm sure there is a clean, simpler way but I can not figure it out. Thanks!
<target name="chk-ejbjndi-notuptodate">
<condition property="${jndiPrefix}_notuptodate">
<and>
<uptodate targetfile="${app.module.dir}\NO_Prefix\${ejb.jar.name}"
>
<srcfiles dir= "${this.ejb.build.dir}" includes="**/*.class"/>
</uptodate>
<not>
<uptodate
targetfile="${app.module.dir}\${jndiPrefix}\${ejb.jar.name}" >
<srcfiles dir= "${this.ejb.build.dir}"
includes="**/*.class"/>
</uptodate>
</not>
</and>
</condition>
<propertycopy name="jndi_outofdate" from="${jndiPrefix}_notuptodate"
silent="true">
<echo>${jndiPrefix} notuptodate: ${jndi_property}</echo>
</target>
<target name="ejb.jar" depends="chk-ejbjndi-notuptodate"
if="jndi_outofdate">
...
</target>
==================== <outofdate> ============================== <target
name="chk-ejbjndi-notuptodate">
<uptodate property="ejb_uptodate"
targetfile="${app.module.dir}\NO_Prefix\${ejb.jar.name}" >
<srcfiles dir="${this.ejb.build.dir}" includes="**/*.class"/>
</uptodate>
<outofdate property="jndi_notuptodate">
<sourcefiles>
<fileset dir="${this.ejb.build.dir}" includes="**/*.class"/>
</sourcefiles>
<targetfiles>
<pathelement
path="${app.module.dir}\${jndiPrefix}\${ejb.jar.name}"/>
</targetfiles>
</outofdate>
<if>
<and>
<isset property="ejb_uptodate"/>
<isset property="jndi_notuptodate"/>
</and>
<then>
<property name="jndi_outofdate" value="true"/>
</then>
</if>
<echo>${jndiPrefix} notuptodate: ${jndi_outofdate}</echo>
</target>
<target name="ejb.jar" depends="chk-ejbjndi-notuptodate"
if="jndi_outofdate">
...
</target>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
|