You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Amy Cheung <am...@yahoo.com> on 2003/12/15 23:15:52 UTC

questions about classpath and FileSet

Hi, can someone please explain these to me?

1. two jars of the same name, one is on the system
CLASSPATH and one in Javac's classpath attribute. When
javac is run, which is used? My experiment shows that
they both could be searched when classes are not found
in either of them. If they are both searched, which
get searched first?

2. can fileset's dir attribute takes a pattern instead
of a specific directory? 
our project has this file structure:
top/componentA/X/src/a/b/c/some_java_files
top/componentB/Y/src/a/b/c/some_java_files
top/componentC/Z/src/a/b/c/some_java_files

I want to copy all java files to a tmp directory and
make it look like: tmp/a/b/c/all_java_fles
But this didn't work: 
<copy todir="tmp">
  <fileset dir="top/**/src">
</copy>

Is there a way to accomplish the task without
explicitly copying each individual src directories?

Thanks in advance for your response. 
Amy


    

__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

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


Re: questions about classpath and FileSet

Posted by Stefan Bodewig <bo...@apache.org>.
On Mon, 15 Dec 2003, Amy Cheung <am...@yahoo.com> wrote:

> 1. two jars of the same name, one is on the system
> CLASSPATH and one in Javac's classpath attribute. When
> javac is run, which is used?

There are several factors that influence the outcome.  By default, the
one from javac's classpath will be found first.

If you set includeantruntime to true (the default), the system
CLASSPATH is appended to the task supplied <classpath>.  If it is
false, the system CLASSPATH is going to be ignored completely.

If you set the magic build.sysclasspath property, the rules change
completely, see <http://ant.apache.org/manual/sysclasspath.html> for
the results.

> 2. can fileset's dir attribute takes a pattern instead
> of a specific directory? 

no.

> our project has this file structure:
> top/componentA/X/src/a/b/c/some_java_files
> top/componentB/Y/src/a/b/c/some_java_files
> top/componentC/Z/src/a/b/c/some_java_files
> 
> I want to copy all java files to a tmp directory and
> make it look like: tmp/a/b/c/all_java_fles
> But this didn't work: 
> <copy todir="tmp">
>   <fileset dir="top/**/src">
> </copy>

Use multiple filesets or a mapper.

<copy todir="tmp">
  <fileset dir="top" includes="*.java"/>
  <mapper type="regexp" from=".*/src/(.*)" to="\1"/>
</copy>

should work (note, you need JDK 1.4 or Jakarta ORO or Jakarta Regexp
for the regexp mapper - ORO is recommended).

Stefan
-- 
http://stefanbodewig.blogger.de/

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