ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peter reilly <peter.rei...@corvil.com>
Subject Re: dynamically setting path id (name)
Date Fri, 08 Aug 2003 10:46:41 GMT
Sorry about my last e-mail, I meant to
explain a little more.

The id field of <path id="x"> gets resolved
at parse time and not at run-time.
This is to allow the element to be accessed outside
of the normal execution run.

So one cannot do <path id="${project.name}.compile.path"/>.

One would need to do:
<project name="projecta">

   <path id ="projecta.compile.path">
     <pathelement path=...../>
   </path>
</project>

and assuming project.name is set to "projecta" in the caller build
    <ant dir="${mountpoint.projects}"
       antfile="extract-libpaths.xml"
       target="getProjectLibs">
     </ant>
     <!-- compile the source -->
     <javac
       srcdir="${project.src.dir}"
       destdir="${project.build.classes.dir}"
       debug="${project.build.debug}">
       <classpath refid="${project.name}.compile.classpath"/>
     </javac>

WARNING: I have not run the above script!

Peter

On Friday 08 August 2003 11:17, Svetlin Stanchev wrote:
> You are perfectly right.
>
> I messed up by including not matching versions of the compile target and
> extract-libpaths.xml.
> Let me try again, please.
> I want to compile a sequence of projects referred to by ${project.name}
> and I have extract-libpaths.xml which finds out all libs needed for
> compilation of any individual project. ${project.name} is known in the
> compile target and the <ant/> task by default is passing it to the
> extract-libpaths.xml.
> Now how can I set the id of the path in extract-libpaths.xml based on
> the project name so that I can refer to it from the <javac/> task inside
> the compile target of build.xml?
>
> Using in both extract-libpaths.xml and build.xml:
> project-compile-classpath
> I get:
> BUILD FAILED
> file:<my_build_file_with_compile_target> Reference
> project-compile-classpath not found.
> (probably because in extract-libpaths.xml I am setting the id before
> associating it with a path?)
>
> But using in both places directly:
> ${project.name}.compile.classpath
> also fails with the error message attached below.
> (that is why I thought <path id.../> does not allow dynamic setting of
> the id using ant properties, but the id value should be set in a
> property before associating it with a path instead)
>
> I do not see another way to dynamically set the id of the path with the
> project name in extract-libpaths.xml so that I can use it in the compile
> target.
> Hope I did not mess-up again...
>
> I'll appreciate further suggestions,


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


Mime
View raw message