You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Surya Kiran <su...@calypso.com> on 2012/03/07 03:20:45 UTC

not working for having multiple tags

Folks,

I have a <javac> task as below

<javac destdir="${build}"
         classpath="xyz.jar"
         debug="on">

    <src path="${src}"/>
    <src path="${src2}"/>

    <include name="mypackage/p1/**"/>
    <include name="mypackage/p2/**"/>

    <exclude name="mypackage/p1/testpackage/**"/>
</javac>

But <exclude> is not working.

Please let me know whats the problem or any other alternatives. Due to legacy structure we need to put multiple <src> tags in <javac>

Please help. Thanks

Re: not working for having multiple tags

Posted by Stefan Bodewig <bo...@apache.org>.
On 2012-03-07, Joe Attardi wrote:

> On Tue, Mar 6, 2012 at 11:51 PM, Stefan Bodewig <bo...@apache.org> wrote:

>> No.  exludes always take precedence over includes, the order of elements
>> is not relevant.  If you need a different behavior, you have to use
>> selectors.

> Sorry, my mistake.

Don't worry, if I sounded harsh in any way, this was not intended.

Stefan

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


Re: not working for having multiple tags

Posted by Joe Attardi <jo...@attardi.net>.
On Tue, Mar 6, 2012 at 11:51 PM, Stefan Bodewig <bo...@apache.org> wrote:

> No.  exludes always take precedence over includes, the order of elements
> is not relevant.  If you need a different behavior, you have to use
> selectors.


Sorry, my mistake.

>

Re: not working for having multiple tags

Posted by Stefan Bodewig <bo...@apache.org>.
On 2012-03-07, Joe Attardi wrote:

> Have you tried reversing the order of the <include> and <exclude>
> elements?  Not sure if this makes a difference, but you're including
> everything under mypackage/p1/** then excluding something under
> p1. Could it be a precedence issue?

No.  exludes always take precedence over includes, the order of elements
is not relevant.  If you need a different behavior, you have to use
selectors.

Stefan

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


Re: not working for having multiple tags

Posted by Joe Attardi <jo...@attardi.net>.
Have you tried reversing the order of the <include> and <exclude> elements?
Not sure if this makes a difference, but you're including everything under
mypackage/p1/** then excluding something under p1. Could it be a precedence
issue?

On Tue, Mar 6, 2012 at 9:20 PM, Surya Kiran <su...@calypso.com> wrote:

> Folks,
>
> I have a <javac> task as below
>
> <javac destdir="${build}"
>         classpath="xyz.jar"
>         debug="on">
>
>    <src path="${src}"/>
>    <src path="${src2}"/>
>
>    <include name="mypackage/p1/**"/>
>    <include name="mypackage/p2/**"/>
>
>    <exclude name="mypackage/p1/testpackage/**"/>
> </javac>
>
> But <exclude> is not working.
>
> Please let me know whats the problem or any other alternatives. Due to
> legacy structure we need to put multiple <src> tags in <javac>
>
> Please help. Thanks
>



-- 
*Joe Attardi*
joe@attardi.net

Re: not working for having multiple tags

Posted by Stefan Bodewig <bo...@apache.org>.
On 2012-03-07, Surya Kiran wrote:

> I have a <javac> task as below

> <javac destdir="${build}"
>          classpath="xyz.jar"
>          debug="on">

>     <src path="${src}"/>
>     <src path="${src2}"/>

>     <include name="mypackage/p1/**"/>
>     <include name="mypackage/p2/**"/>

>     <exclude name="mypackage/p1/testpackage/**"/>
> </javac>

> But <exclude> is not working.

By "exclude is not working" I assume javac compiles classes in
mypackage/p1/testpackage/** - right?  Why do you think the presence of
more than one <src> element is the problem?

The include/exclude elements only control which source files Ant
considers when putting together the command line.  It will not pass any
source files under mypackage/p1/testpackage/ as files to compile to
javac.  You can run "ant -verbose" to verify that.

There may be other reasons why javac decides to still compile those
classes.  In particular if one of the other classes references a class
in mypackage.p1.testpackage - after all javac knows where to look for
them.

Stefan

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