The message that I posted shortly ago about using the scope tag to get 
around a problem with setting properties in an ant tag is incorrect.

This project has several tables and they are divided into smaller schemas 
to make them more manageable. The properties file for each subproject 
defines a torque.project that is used to find the appropriate files. This 
process works as a shell script. With maven though the first time through 
the loop is setting the torque.project and it is not changing thereafter.

If I switch and use the <util:properties> it does not do the substitutions 
in the properties files and I end up with variables like:

torque.database.url = \
  jdbc:${torque.database}://${torque.database.host}/test_${turbine.project}

(The test_ is a substitution from a properties file that is included.)

Even if the substitutions were working it wouldn't matter because the 
variables are not available as properties to the ant task.

I'm sort of at a loss right now:
 1. I can't use the <property> tags inside <ant> because the cause an 
     error
 2. I can't use the <property> tags inside a <scope> because scope doesn't 
     apply to properties (noticed the "properties are immutable note in 
     the ant docs")
 3. I can't use the <u:properties> tags because the variable expansions 
     aren't done (and properties would still likely be immutable)

*-*

Ok, messed around a bit more and found at least one solution:

<antcall> will look in build.xml for the target that is specified. A 
simple build.xml can be created with a single target:

<target name="exec-torque">
  <property file="src/sql/torque/${project}_schema/build.properties"/>
  <property file="src/sql/torque/schema.build.properties"/>
  <echo>Executing ${target} from ${torque.buildfile} for ${project} 
(${torque.database.url})</echo>
  <ant antfile="${torque.buildfile}" target="${target}"/>
</target>

The execTorque <taskdef> then looks like:

 <j:forEach items="${targets}" var="target">
   <antcall target="exec-torque">
     <param name="project" value="${project}"/>
     <param name="target" value="${target}"/>
     <param name="torque.buildfile" value="${torque.buildfile}"/>
   </antcall>
 </j:forEach>

This seems to be working. (I think.) =)

Will




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to