ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <h...@visi.com>
Subject Re: Javac task not strict enough on include and exclude?
Date Thu, 18 Mar 2004 13:25:04 GMT
Any classes depended on by classes being compiled will be included whether 
you try to exclude them or not.  The only way to solve this would be to 
move distinct modules to separate package hierarchies and only put the one 
you want to compile in the classpath you give to <javac>.  You will have to 
remember to build things in a proper order so that the package that the 
other classes depend on are compile first and then put in the classpath for 
<javac> when you build the other packages.  Always remember to limit your 
classpath as much as possible to be able to catch circular references 
between packages that are supposed to be independent.

Basically, you'll have hierarchy like this...

component1/src/com/mycompany/....

component2/src/com/mycompany/....

Where component2 depends on component1, but not vice-versa.  Build 
component1 first, then put the classes generated by that build into the 
classpath when building component2.  Neither case references the other's 
sourcepath, so you won't have classes "sucked in".


Jake

At 01:42 PM 3/18/2004 +0100, you wrote:
>Is there some way to force the restriction of include and exclude within
>the javac task? Currently classes outside these filters will still get
>sucked in and compiled if classes inside the filters require them. I need
>the javac to fail instead in this case.
>
>
>=== Further Info ===
>In our project's compilation process, there are 3 stages to force
>separation between packages. That is, beans and konstanter packages should
>not require classes from any other package, and no class anywhere should
>require a service implementation class (eg *Impl.java). Currently all the
>classes exist under the same package heirarchy. Unfortunately the
>following ant script does not work. Despite the include and exclude
>usages, classes not specified will still be sucked in and compiled if
>referenced to.
>
>
>         <!-- Make sure Beans and Constants are standalone classes --> <!--
>         [FIXME]  Other classes will still be sucked in if needed without
>         error --> <javac debug="true" deprecation="true"
>         destdir="${classdir}" optimize="true" source="1.4"
>         srcdir="${src}">
>             <classpath refid="classpath"/>
>             <include name="**/beans/*.java"/>
>             <include name="**/konstanter/*.java"/>
>         </javac>
>         <!-- Make sure Service Implementation classes are not used -->
>         <!-- [FIXME]  Tjenester Implementation will still be sucked in if
>         needed without error --> <javac debug="true" deprecation="true"
>         destdir="${classdir}" optimize="true" source="1.4"
>         srcdir="${src}">
>             <classpath refid="classpath"/>
>             <!-- Separate the Tjenester Implementation classes to catch
>             illegal references --> <exclude name="**/*TjenesteImpl.java"/>
>         </javac>
>         <!-- Now compile the Service Implementation classes --> <javac
>         debug="true" deprecation="true" destdir="${classdir}"
>         optimize="true" source="1.4" srcdir="${src}">
>             <classpath refid="classpath"/>
>             <include name="**/tjenester/*/*Impl.java"/>
>         </javac>
>
>Mick.
>
>--
>-- <BR/>
>"Work like you don't need the money. Love like you've never been hurt. 
>Dance like nobody's watching." Satchmo Paige
><BR/> --- <a href=http://www.bokklubbene.no>De norske Bokklubbene</a>
---
>
>
>
>---------------------------------------------------------------------
>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