You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Anand HS <an...@gmail.com> on 2011/01/05 01:36:40 UTC

Exclusion does not work when using dependencies generated using assembly plug in

Hi,
I have a project with the following structure

- ROOT
  - ModuleA
      - GeneratedDistribution.jar
      - Several Dependencies
  - ModuleB
     - Several Dependencies
     - Depends on GeneratedDistribution.jar
         - <ExclusionofDependenciesofModuleA>

Now When i build from ROOT, the exclusions do not really get excluded.
However, when i build from inside ModuleB, the exclusions get excluded.

I use Maven 2.0.9 but have also tried on 2.0.10 and the problem exists.

Any solution on  how to ensure a uniform behavior of ModuleA's dependencies
to be excluded from ModuleB.  would be appreciated

Thanks,
Anand

Re: Exclusion does not work when using dependencies generated using assembly plug in

Posted by Benjamin Bentmann <be...@udo.edu>.
Anand HS wrote:

> 4. Now when I invoke mvn install from the ROOT pom, I see that ModuleA and
> ModuleA-distribution.jar get build with no issues. Now when ModuleB is
> built, in spite of explicit exclusion of ModuleA's dependencies , those
> dependencies do not get excluded.

Could be http://jira.codehaus.org/browse/MNG-4872.


Benjamin

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


Re: Exclusion does not work when using dependencies generated using assembly plug in

Posted by Anand HS <an...@gmail.com>.
Hi,
Apologize for not providing more details.

Here are more details -

1. The ROOT is a ROOT pom that builds both ModuleA and ModuleB.
2. ModuleA uses assembly plug in to generate a Distribution jar. Here is the
distribution XML that builds this jar -

<!--
This is the maven assembly descriptor file. It is used by maven assemly
plugin defined in
POM.xml for atlasservice-jar to churn out a distributable jar that can be
used by web service
clients.

Since: Version 1.0
-->
<assembly>
  <id>distribution</id>
  <formats>
    <format>jar</format>
  </formats>
  <includeBaseDirectory>false</includeBaseDirectory>
  <fileSets>
<fileSet>
<directory>${basedir}/target/classes</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>com/psi/common/*.class</include>
</includes>
<excludes>
<exclude>com/psi/common/ErrorConstants.class</exclude>
</excludes>
</fileSet>
  </fileSets>
</assembly>

3. Now ModuleB uses this Distribution.jar as a dependency. The POM of
ModuleB is given below . -


<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.psi.lc</groupId>
    <artifactId>psi-lc-ops</artifactId>
    <packaging>war</packaging>
    <name>psi-lc-ops</name>
    <parent>
        <groupId>com.psi</groupId>
        <artifactId>lc</artifactId>
        <version>${lc.version}</version>
    </parent>
    <scm>
        <developerConnection>
    scm:svn:
https://cobasvn01.coreobjects.com/svn/PSI/products/LC/apps/Atlas/trunk/atlas-web
        </developerConnection>
    </scm>
    <dependencies>
<!-- START: dependencies for older psi-lc-ops -->
        <dependency>
            <groupId>jstl</groupId>
            <artifactId>jstl</artifactId>
            <version>1.1.2</version>
        </dependency>
        <dependency>
            <groupId>xmlparser</groupId>
            <artifactId>xmlparser</artifactId>
            <version>2.0</version>
        </dependency>
        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
            <version>1.4</version>
            <exclusions>
                <exclusion>
                    <groupId>javax.activation</groupId>
                    <artifactId>activation</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>standard</groupId>
            <artifactId>standard</artifactId>
            <version>1.0</version>
        </dependency>

<!-- Unit Testing dependencies -->
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>5.12.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
            <version>1.8.5</version>
            <scope>test</scope>
        </dependency>
<!-- Unit Testing dependencies end -->

        <dependency>
            <groupId>com.psi.lc</groupId>
            <artifactId>ModuleA</artifactId>
            <version>${lc.version}</version>
            <classifier>distribution</classifier>
            <type>jar</type>
            <exclusions>
                <exclusion>
                    <groupId>quartz</groupId>
                    <artifactId>quartz</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>psistatefunctions</groupId>
                    <artifactId>psistatefunctions</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>corecccejb</groupId>
                    <artifactId>corecccejb</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>anttex</groupId>
                    <artifactId>anttex</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>treeapplet</groupId>
                    <artifactId>treeapplet</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>Verisign</groupId>
                    <artifactId>Verisign</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>reportgenfiles</groupId>
                    <artifactId>reportgenfiles</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>commons-digester</groupId>
                    <artifactId>commons-digester</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>javax.xml.bind</groupId>
                    <artifactId>jaxb-api</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.cxf</groupId>
                    <artifactId>cxf-rt-frontend-jaxws</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.psi</groupId>
                    <artifactId>contentservice</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.cxf</groupId>
                    <artifactId>cxf-rt-ws-security</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.ws.security</groupId>
                    <artifactId>wss4j</artifactId>
                </exclusion>
<exclusion>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>fop</artifactId>
</exclusion>
<exclusion>
<groupId>com.psi</groupId>
<artifactId>FOReportGenerator</artifactId>
</exclusion>
<exclusion>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.avalon.framework</groupId>
<artifactId>avalon-framework-impl</artifactId>
</exclusion>
            </exclusions>
        </dependency>
    </dependencies>
    <build>
        <finalName>psi-lc-ops</finalName>
<!-- This plugin is used here to build the manifest file -->
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.0.2</version>
                <configuration>
                    <manifest>

 <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                    </manifest>
                    <archive>
                        <manifestEntries>

 <Build-Machine>${env.COMPUTERNAME}</Build-Machine>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
        </plugins>

    </build>
    <repositories>
        <repository>
            <id>maven-central</id>
            <url>http://repo1.maven.org/maven2</url>
            </repository>
        </repositories>
    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jxr-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-pmd-plugin</artifactId>
                <version>2.5</version>
                <configuration>
                    <rulesets>
                        <ruleset>rulesets/basic.xml</ruleset>
                        <ruleset>rulesets/braces.xml</ruleset>
                        <ruleset>rulesets/codesize.xml</ruleset>
                        <ruleset>rulesets/coupling.xml</ruleset>
<!-- ruleset>rulesets/clone.xml</ruleset>
<ruleset>rulesets/favorites.xml</ruleset>
<ruleset>rulesets/finalizers.xml</ruleset>
<ruleset>rulesets/imports.xml</ruleset>
<ruleset>rulesets/junit.xml</ruleset>
<ruleset>rulesets/migrating_to_15.xml</ruleset>
<ruleset>rulesets/optimizations.xml</ruleset>
<ruleset>rulesets/typeresolution.xml</ruleset>
<ruleset>rulesets/unusedcode.xml</ruleset>
<ruleset>rulesets/strings.xml</ruleset>
too hardcore
<ruleset>rulesets/controversial.xml</ruleset>
<ruleset>rulesets/design.xml</ruleset>
<ruleset>rulesets/logging-java.xml</ruleset>
<ruleset>rulesets/strictexception.xml</ruleset>
<ruleset>rulesets/naming.xml</ruleset -->
                    </rulesets>
                    <linkXRef>true</linkXRef>
                    <includeTests>true</includeTests>
                    <sourceEncoding>utf-8</sourceEncoding>
                    <minimumPriority>5</minimumPriority>
                    <minimumTokens>20</minimumTokens>
                    <targetJdk>1.5</targetJdk>
<!--includes>
<include>com/psi/ops/services/**/*.class</include>
   </includes-->
                    <excludeRoots>

 <excludeRoot>target/generated-sources/stubs</excludeRoot>
                    </excludeRoots>
                </configuration>
            </plugin>

 <!-- Code coverage report generator -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>cobertura-maven-plugin</artifactId>
                <version>2.1</version>
                <configuration>
                    <check>
                        <haltOnFailure>false</haltOnFailure>
                        <regexes>
                            <regex>
                                <pattern>com.psi.ops.services.*</pattern>
                                <branchRate>90</branchRate>
                                <lineRate>90</lineRate>
                            </regex>

                        </regexes>
                    </check>
                    <instrumentation>
                        <includes>

 <include>com/psi/ops/services/**/*.class</include>
                        </includes>
                    </instrumentation>
                </configuration>
            </plugin>
        </plugins>
    </reporting>
</project>

4. Now when I invoke mvn install from the ROOT pom, I see that ModuleA and
ModuleA-distribution.jar get build with no issues. Now when ModuleB is
built, in spite of explicit exclusion of ModuleA's dependencies , those
dependencies do not get excluded.

Hope I have provided more details. I can provide more details if required.

Cheers.!!
Anand

On Wed, Jan 5, 2011 at 2:24 AM, Anders Hammar <an...@hammar.net> wrote:

> What do you mean when you say that the exclusions don't get excluded when
> you build from the root?
> The subject mentions the assembly plugin, but I don't see that mentioned in
> your structure.
>
> More info, please!
>
> /Anders
>
> On Wed, Jan 5, 2011 at 01:36, Anand HS <an...@gmail.com> wrote:
>
> > Hi,
> > I have a project with the following structure
> >
> > - ROOT
> >  - ModuleA
> >      - GeneratedDistribution.jar
> >      - Several Dependencies
> >  - ModuleB
> >     - Several Dependencies
> >     - Depends on GeneratedDistribution.jar
> >         - <ExclusionofDependenciesofModuleA>
> >
> > Now When i build from ROOT, the exclusions do not really get excluded.
> > However, when i build from inside ModuleB, the exclusions get excluded.
> >
> > I use Maven 2.0.9 but have also tried on 2.0.10 and the problem exists.
> >
> > Any solution on  how to ensure a uniform behavior of ModuleA's
> dependencies
> > to be excluded from ModuleB.  would be appreciated
> >
> > Thanks,
> > Anand
> >
>

Re: Exclusion does not work when using dependencies generated using assembly plug in

Posted by Anders Hammar <an...@hammar.net>.
What do you mean when you say that the exclusions don't get excluded when
you build from the root?
The subject mentions the assembly plugin, but I don't see that mentioned in
your structure.

More info, please!

/Anders

On Wed, Jan 5, 2011 at 01:36, Anand HS <an...@gmail.com> wrote:

> Hi,
> I have a project with the following structure
>
> - ROOT
>  - ModuleA
>      - GeneratedDistribution.jar
>      - Several Dependencies
>  - ModuleB
>     - Several Dependencies
>     - Depends on GeneratedDistribution.jar
>         - <ExclusionofDependenciesofModuleA>
>
> Now When i build from ROOT, the exclusions do not really get excluded.
> However, when i build from inside ModuleB, the exclusions get excluded.
>
> I use Maven 2.0.9 but have also tried on 2.0.10 and the problem exists.
>
> Any solution on  how to ensure a uniform behavior of ModuleA's dependencies
> to be excluded from ModuleB.  would be appreciated
>
> Thanks,
> Anand
>