ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel H A Lima <>
Subject Re: dynamically setting path id (name)
Date Fri, 08 Aug 2003 13:19:54 GMT
    I don't know if i understood your problem but i've used a property 
file to store classpath information between the two .xml. The task 
"pathconvert" replaces "windows-like" directory separator ( "\" ).
    I don't like so much of my solution :-), but...

<?xml version="1.0"?>
<project name="path" default="main" basedir=".">
   <target name="main">
      <property name="" value="my_proj"/>
      <ant antfile="nested_path.xml" target="set_nested_path"/>
      <property file="${}.classpath"/>

       <!-- This only show nested.path contents -->
      <path id="p">
         <pathelement location="${nested.path}"/>
      <property name="p" refid="p"/>
      <echo message="path = ${p}"/>

<?xml version="1.0"?>
<project name="nested_path" default="set_nested_path" basedir=".">
   <target name="set_nested_path">
     <pathconvert dirsep="/" property="tmp_classpath">
        <path id="tmp_id">
           <fileset dir=".">
              <include name="*"/>
           <pathelement location="path.xml:nested_path.xml"/>
     <echo message="nested.path=${tmp_classpath}" 

Svetlin Stanchev wrote:

>Well, this is exactly what I have now (if I understand you correctly).
>I have currently a project-specific directory with a props.xml file
>inside it containing a definition of the project's compile path with
>fixed id. If a project name or smth else changes, I need to edit it
>there manually.
>However, for the actual project build of java projects (because I have
>others too) I am using a "build template" which gets copied to the
>project directory and from there it loads the props.xml. 
>But, now I have extract-libpaths.xml which gives me back the compile
>classpath (along with other info) based on external JBuilder settings.
>So why not make evth automatic by somehow dynamically setting the
>classpath attribute of javac?
>This way, from the masterbuild based on a list of projects I can create
>a project dir for each, copy the modified template, find out with
>extract-libpaths.xml dynamically from the JBuilder configs the needed
>compile classpath, compile, make distributables, delete project dir if
>needed, over. I don't want to maintain manually a JBuilder<->Ant lib and
>other mappings for dozens of projects!
>Well, if path id gets resolved static, then I can't use ant properties
>in it.
>Then I guess I have no choice but to create these same props.xml
>manually using xmltask or smth similar before I try calling the project
>build using props.xml (because I am using ant 1.5 with also static XML
>If somebody has a better idea, please let me know.
>Thank you, Peter.


Daniel Henrique Alves Lima, Software Engineer
CiT Systems - Software enabling  the e-world
Phone: +55 19 3737 4596
       +55 19 3737 4500
Fax:   +55 19 3737 4501          

"Spike once ask me... What does it take for a soldier to become a 
 leader... What differentiates the two ?
 There is no difference. Sometimes certain soldiers are chosen to lead
 other soldiers. (...) But they never stop being soldiers.
 Because when the stakes are high... When the battle burns... When
 the death seems near... You either fight or your don't. You're either a
 soldier or you're not. (...) I'm a soldier. I fight. That's what i do."

	            Optimus Prime : TF - G1 : DW

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message