ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Milind Nirgun" <Nirg...@C-IV.org>
Subject RE: Problems with <exclude> in javac
Date Tue, 23 Jul 2002 21:43:27 GMT
Ant only passes those files that need to be compiled and are not in the exclusion list to javac.
I tried out an example based on Nathan's problem and I got perfect results as expected. My
build script is :

<property name="srcDir" value="c:\temp\testingAnt\srcdir" />
<property name="buildDir" value="c:\temp\testingAnt\buildDir" />

<target name="compile" description="clean up" >
    <javac 
	  srcDir="${srcDir}" 
	  destdir="${buildDir}" 
	  classpath="${classpath}"
          debug="off">            
      <include name="com/**" /> 
      <exclude name="com/package1/File1.java"/>
      <exclude name="com/package2/File2.java"/>
    </javac>
</target>
 
<target name="clean" description="clean up" >
        <delete dir="${buildDir}/com" failonerror="false" />        
</target>

I ran the above script with a directory structure as follows:

\srcdir
  |--com
  |----package1
  |     |---File1.java (imports File3)
  |     |---File3.java 
  |----package2
        |---File2.java

Results:  The files File1.java & File2.java never ever get compiled. Every time I run
with target clean or touch File3.java, only the File3.java gets compiled.

And that is expected behaviour. So Nathan check your directory structure and script again.
Try out the above if you still have doubts.

-Milind



-----Original Message-----
From: Diane Holt [mailto:holtdl@yahoo.com]
Sent: Tuesday, July 23, 2002 2:13 PM
To: Ant Users List
Subject: RE: Problems with <exclude> in javac


--- Nathan Paris <nathan.paris@laurelhillgis.com> wrote:
> The ${srcDir} variable is src/ .  Inside src/ I have the packages:
> 
> src/com/package1
> src/com/package2
> 
> So my src variable is where the package-structure is located, but
> doesn't include the package structure.  So what I am doing should work,
> right?

Java compilers will compile whatever files they need, if they can find
them (which, since these two files live in the same source path as the
other files you're compiling, it will). So if these two are referenced by
the files you do want to compile, the compiler will go find them and
compile them, regardless of whether they're in the actual list of files
you've handed off to the compiler.

Diane

=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com

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


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


Mime
View raw message