ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <h...@visi.com>
Subject Re[2]: error in <javac> using multiple src dirs...
Date Tue, 25 Feb 2003 16:44:07 GMT
Hello Zac,

The reason why <javac>'s "src" attribute takes multiple directories as
an alternative to nesting multiple <src> elements is because the
former allows one to put all info on a single string.  That allows you
to change a single property to modify the behavior of a common <javac>
task rather than hardcoding specific <src> entries.  If something
changes, I don't want to have to modify the <javac> task.  I just want
to modify the string that I send to the "src" attribute of the <javac>
task.  That way, I can have one target that I <antcall> which performs
javac on as many separate sources as I care to specify while writing
only a single target for <javac>.

So, given that context, how would I do this.  I also know about, and
have used, the <foreach> tasks in the ant contrib project.  However, I
have a requirement to keep this limited to what Ant-1.5.1 provides.
So, the challenge is to figure out a way to do what I want given my
constraints.

I have a couple of other ideas such as making a couple more
<antcall>'s for cases where I have multiple source directories to
copy resources after <javac>'ing.  It would just make it simpler if
the <copy> task could copy stuff from multiple places just as <javac>
can compile java files from multiple source directories.

Jake

Tuesday, February 25, 2003, 9:31:01 AM, you wrote:


>> Actually, how am I going to get around this one?  The compile 
>> task can take 
>> multiple src directories, but how am I going to do a copy of 
>> those same 
>> multiple directories?
>> 
>> >According to the docs, I can provide multiple paths.  The 
>> >docs give the example of...
>> >
>> ><javac srcdir="${src}:${src2}"
>> >          destdir="${build}"
ZT> ...
>> >   />
>> >
>> >I am assuming that the colon separator in this example is for UNIX 
>> >systems.  I am on Windows.  I set the path up using the following...
>> ><property name="src.contrib.projects" 
>> >value="${src.contrib.home}/rollbackWithMementoPattern${path.s
>> eparator}${src.contrib.home}/jxpath" 
>> >/>
>> >

ZT> Jake, you don't need to construct the source path in that way, take 
ZT> a look at Ant's documentation on Path-like Structures.

ZT> If you need to copy multiple directories, I think you will need to 
ZT> specify each one individually.  You can do the same with the javac
ZT> task with nested src elements, by the way.  Is there a need to have
ZT> the set of directories specified in a single property, other than
ZT> convenience?

ZT> I understand that there are tasks outside the java project which
ZT> may allow you to iterate through the set of dirs in the copy stage, 
ZT> (foreach?) but I have never even inspected them.

ZT> Zac

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



-- 
Best regards,
 Jacob                            mailto:hoju@visi.com


Mime
View raw message