You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Wendy Smoak <ws...@gmail.com> on 2009/08/30 23:06:57 UTC

Re: Maven compiler plugin adds unnecessary dependent classes to output folder

On Sun, Aug 30, 2009 at 1:15 PM, Andrey
Razumovsky<ra...@gmail.com> wrote:

> I've got a project with e.g. jar packaging. All my dependencies have
> "provided" scope. My problem is that Maven compiler plugin adds unnecessary
> classes from dependent library to output folder - e.g. if I have a class
> mypack.MyServlet extends HttpServlet, javax.servlet package will be present
> in compile output directory and therefore will be added to resulting JAR.

Can you reproduce this with a simple project started from the
quickstart archetype?  I've never seen the jar plugin package up
dependencies.  (You can do it with the assembly plugin.)  Without
seeing the pom it's hard to guess what you've done so far.

-- 
Wendy

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Maven compiler plugin adds unnecessary dependent classes to output folder

Posted by Andrey Razumovsky <ra...@gmail.com>.
BWT, is it possible to include *only* classes I specify in <include> tag and
dependent from my classpath? E.g. my structure is

mypackage
    client
        A.java
        B.java
    server
        C.java --> C extends A

and maven-compiler-plugin contains <include>mypackage/server/**</include>
then I want my resulting jar contain only C and A classes. I thought normal
javac does just that - compliles specified classes and dependent ones, but
Maven gives me compiler error telling that client classes were not found..

2009/8/31 Andrey Razumovsky <ra...@gmail.com>

> Thanks for your answers.
> Stephen, you are right. javax.servlet is coming from GWT-dev jar, and
> others from my GWT-based libraries, which must contain sources. How can I
> exclude them from compilation? Adding
>
> <plugins>
>         <plugin>
>                 <groupId>org.apache.maven.plugins</groupId>
>                 <artifactId>maven-compiler-plugin</artifactId>
>                 <configuration>
>                     <includes>
>                         <include>mypackage/**</include>
>                     </includes>
>                 </configuration>
>             </plugin>
>
> didn't help...
>
> 2009/8/31 Stephen Connolly <st...@gmail.com>
>
> is this not the bug where if the dependent jar contains .java files, then
>> javac decides to compile them?
>>
>> check the jar that you think the classes are coming from and see if that
>> jar also has the source of the classes within
>>
>> Sent from my [rhymes with myPod] ;-)
>>
>>
>> On 30 Aug 2009, at 22:06, Wendy Smoak <ws...@gmail.com> wrote:
>>
>>  On Sun, Aug 30, 2009 at 1:15 PM, Andrey
>>> Razumovsky<ra...@gmail.com> wrote:
>>>
>>>  I've got a project with e.g. jar packaging. All my dependencies have
>>>> "provided" scope. My problem is that Maven compiler plugin adds
>>>> unnecessary
>>>> classes from dependent library to output folder - e.g. if I have a class
>>>> mypack.MyServlet extends HttpServlet, javax.servlet package will be
>>>> present
>>>> in compile output directory and therefore will be added to resulting
>>>> JAR.
>>>>
>>>
>>> Can you reproduce this with a simple project started from the
>>> quickstart archetype?  I've never seen the jar plugin package up
>>> dependencies.  (You can do it with the assembly plugin.)  Without
>>> seeing the pom it's hard to guess what you've done so far.
>>>
>>> --
>>> Wendy
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>

Re: Maven compiler plugin adds unnecessary dependent classes to output folder

Posted by Andrey Razumovsky <ra...@gmail.com>.
Thanks for your answers.
Stephen, you are right. javax.servlet is coming from GWT-dev jar, and others
from my GWT-based libraries, which must contain sources. How can I exclude
them from compilation? Adding

<plugins>
        <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <includes>
                        <include>mypackage/**</include>
                    </includes>
                </configuration>
            </plugin>

didn't help...

2009/8/31 Stephen Connolly <st...@gmail.com>

> is this not the bug where if the dependent jar contains .java files, then
> javac decides to compile them?
>
> check the jar that you think the classes are coming from and see if that
> jar also has the source of the classes within
>
> Sent from my [rhymes with myPod] ;-)
>
>
> On 30 Aug 2009, at 22:06, Wendy Smoak <ws...@gmail.com> wrote:
>
>  On Sun, Aug 30, 2009 at 1:15 PM, Andrey
>> Razumovsky<ra...@gmail.com> wrote:
>>
>>  I've got a project with e.g. jar packaging. All my dependencies have
>>> "provided" scope. My problem is that Maven compiler plugin adds
>>> unnecessary
>>> classes from dependent library to output folder - e.g. if I have a class
>>> mypack.MyServlet extends HttpServlet, javax.servlet package will be
>>> present
>>> in compile output directory and therefore will be added to resulting JAR.
>>>
>>
>> Can you reproduce this with a simple project started from the
>> quickstart archetype?  I've never seen the jar plugin package up
>> dependencies.  (You can do it with the assembly plugin.)  Without
>> seeing the pom it's hard to guess what you've done so far.
>>
>> --
>> Wendy
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Maven compiler plugin adds unnecessary dependent classes to output folder

Posted by Stephen Connolly <st...@gmail.com>.
is this not the bug where if the dependent jar contains .java files,  
then javac decides to compile them?

check the jar that you think the classes are coming from and see if  
that jar also has the source of the classes within

Sent from my [rhymes with myPod] ;-)

On 30 Aug 2009, at 22:06, Wendy Smoak <ws...@gmail.com> wrote:

> On Sun, Aug 30, 2009 at 1:15 PM, Andrey
> Razumovsky<ra...@gmail.com> wrote:
>
>> I've got a project with e.g. jar packaging. All my dependencies have
>> "provided" scope. My problem is that Maven compiler plugin adds  
>> unnecessary
>> classes from dependent library to output folder - e.g. if I have a  
>> class
>> mypack.MyServlet extends HttpServlet, javax.servlet package will be  
>> present
>> in compile output directory and therefore will be added to  
>> resulting JAR.
>
> Can you reproduce this with a simple project started from the
> quickstart archetype?  I've never seen the jar plugin package up
> dependencies.  (You can do it with the assembly plugin.)  Without
> seeing the pom it's hard to guess what you've done so far.
>
> -- 
> Wendy
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org