ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Svetlin Stanchev" <stanc...@360t.com>
Subject RE: dynamically setting path id (name)
Date Fri, 08 Aug 2003 10:17:45 GMT
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,
-- 
Svetlin


> -----Original Message-----
> From: peter reilly [mailto:peter.reilly@corvil.com] 
> Sent: Friday, August 08, 2003 10:59 AM
> To: Ant Users List
> Subject: Re: dynamically setting path id (name)
> 
> 
> You seem to be mixing up properties with references.
> 
> The path id at (a) will set the reference "project-compile-classpath".
> 
> This should be referred to at (b) using  
> refid="project-compile-classpath"
> 
> Peter
> 
> On Friday 08 August 2003 09:38, Svetlin Stanchev wrote:
> > I suspect this has been discussed before, but could not 
> find a direct 
> > answer, so here I go:
> >
> > I have an editable by anybody list of Java projects belonging to 
> > certain project groups. Thus, I need to compile any or a 
> group of them 
> > based on the project name/group based on editable 
> (JBuilder) library 
> > configuration files.
> >
> > In my compile target I have smth quite straightforward:
> >   <target name="compile" depends="init">
> >     <!-- checkout current lib config -->
> >     <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"/> <<== (b)
> >     </javac>
> >    </target>
> >
> > In extract-libpaths.xml I have:
> >
> >     <!-- create the compile path -->
> >     <property name="project-compile-classpath" 
> > value="${project.name}.compile.classpath"/>
> >     <path id="project-compile-classpath">  <<==  (a)
> >       <pathelement path="${pathvalue}"/>
> >     </path>
> >     <echo>pathvalue: ${pathvalue}</echo>
> >     <echo>${project.name} compile classpath: 
> > ${project-compile-classpath}</echo>
> >
> > pathvalue is properly set with after parsing the JBuilder 
> lib config 
> > file, however the property holding the path does not get set:
> >      [echo] pathvalue: <a_path_to_a_lib>;<another_path_to_a_lib>;...
> >      [echo] <my_project_name> compile classpath: 
> > <my_project_name>.compile.classpath
> >
> > So the compile target fails with:
> > BUILD FAILED
> > file:<my_build_filename>: Reference 
> > <my_project_name>.compile.classpath
> > not found.
> >
> > I suspect <path id=/> does not allow references?
> > If so, how can I solve my problem?
> >
> > Thankful for any advice,
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 


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


Mime
View raw message