You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Yuval Zilberstein <yu...@gmail.com> on 2015/01/18 10:11:36 UTC

Maven does not respect exclusion

Hi, I have the following pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<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">

<!-- in order to copy the dependencies, run: -->
<!-- mvn clean dependency:copy-dependencies -->
<modelVersion>4.0.0</modelVersion>

<groupId>com.proonto</groupId>
<artifactId>platform-common</artifactId>
<version>1.0</version>
<name>Proonto platform - common</name>
 <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.0.2.RELEASE</version>
</parent>
 <dependencies>
<dependency>
  <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
  <version>1.1.4.RELEASE</version>
        <exclusions>
        <exclusion>
<!-- We already import it in a project that this project depends on -->
        <groupId>org.slf4j</groupId>
        <artifactId>jcl-over-slf4j</artifactId>
        </exclusion>
        <exclusion>
<!-- We already import it in a project that this project depends on -->
        <groupId>org.springframework</groupId>
        <artifactId>spring-aop</artifactId>
        </exclusion>
        </exclusions>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.3.3</version>
</dependency>
<dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-jpa</artifactId>
        <version>1.6.1.RELEASE</version>
        <exclusions>
<exclusion>
<!-- We already import it in a project that this project depends on -->
<groupId>aopalliance</groupId>
<artifactId>aopalliance</artifactId>
</exclusion>
        <exclusion>
<!-- We already import it in a project that this project depends on -->
        <groupId>org.slf4j</groupId>
        <artifactId>jcl-over-slf4j</artifactId>
        </exclusion>
        <exclusion>
<!-- We already import it in a project that this project depends on -->
        <groupId>org.springframework</groupId>
        <artifactId>spring-aop</artifactId>
        </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-redis</artifactId>
        <version>1.3.2.RELEASE</version>
*        <exclusions>*
*        <exclusion>*
* <!-- We already import it in a project that this project depends on -->*
*        <groupId>org.springframework</groupId>*
*        <artifactId>spring-aop</artifactId>*
*        </exclusion>*
* <exclusion>*
* <!-- We already import it in a project that this project depends on -->*
* <groupId>aopalliance</groupId>*
* <artifactId>aopalliance</artifactId>*
* </exclusion>*
*        </exclusions>*
    </dependency>
    <dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-entitymanager</artifactId>
    <version>4.3.5.Final</version>
    <scope>runtime</scope>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.6.0</version>
</dependency>
<dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-redis</artifactId>
        <version>1.3.2.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>4.0.3.RELEASE</version>
        <exclusions>
        <exclusion>
<!-- We already import it in a project that this project depends on -->
        <groupId>org.springframework</groupId>
        <artifactId>spring-aop</artifactId>
        </exclusion>
        </exclusions>
    </dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<configuration>
<outputDirectory>./WebContent/WEB-INF/lib</outputDirectory>
</configuration>
          </plugin>
</plugins>
</build>

</project>

When i run: mvn -X clean dependency:copy-dependencies
maven brings the aopalliance and spring-aop jars, though i specifically
exclude it.
I bolded the section that is being ignored.
Thanks Yuval




-- 
*Yuval Zilberstein*
*Join me online: **Facebook*
<http://www.facebook.com/people/Yuval-Zilberstein/100001194762863> I *Linkdln
<http://il.linkedin.com/pub/yuval-zilberstein/13/6b1/773>* I Google+
<https://plus.google.com/s/yuval%20zilberstein>
*mailto:yuvalzi@gmail.com <yu...@gmail.com>*
*Please consider the impact on the environment before printing this e-mail.*

Re: Maven does not respect exclusion

Posted by Ron Wheeler <rw...@artifact-software.com>.
You might want to look at using Eclipse/STS (free) as your IDE.
Its support for Maven (m2e) is very useful and the dependency hierarchy 
view would have solved this for you very quickly.

Ron

On 18/01/2015 3:45 PM, Yuval Zilberstein wrote:
> Thanks Bernd,
> I found that i mistakenly added the redis dependency twice,
> so excluding dependencies on one did not exclude them from the other.
> This is one of the mistakes that when you discover them you ask yourself
> how didn't i notice that before.
>
>
> On Sun, Jan 18, 2015 at 8:03 PM, Bernd Eckenfels <ec...@zusammenkunft.net>
> wrote:
>
>> Hello,
>>
>> you need to exclude them from all direct dependencies which can drag it
>> in. For this the dependency:tree is a good tool. As you can see, it gets
>> dragged in by
>>
>>                  <dependency>
>>                          <groupId>org.springframework.data</groupId>
>>                          <artifactId>spring-data-redis</artifactId>
>>                          <version>1.3.2.RELEASE</version>
>>                  </dependency>
>>
>> Gruss
>> Bernd
>>
>> BTW: if you did not enter the * into the pom it would have taken me less
>> time to reproduce it. It is alwas a  good idea to add a link to a useable
>> file, thanks!
>>
>>
>> com.proonto:platform-common:jar:1.0
>> +-
>> org.springframework.boot:spring-boot-starter-data-jpa:jar:1.1.4.RELEASE:compile
>> |  +-
>> org.springframework.boot:spring-boot-starter:jar:1.0.2.RELEASE:compile
>> |  |  +- org.springframework.boot:spring-boot:jar:1.0.2.RELEASE:compile
>> |  |  +-
>> org.springframework.boot:spring-boot-autoconfigure:jar:1.0.2.RELEASE:compile
>> |  |  +-
>> org.springframework.boot:spring-boot-starter-logging:jar:1.0.2.RELEASE:compile
>> |  |  |  +- org.slf4j:jul-to-slf4j:jar:1.7.7:compile
>> |  |  |  +- org.slf4j:log4j-over-slf4j:jar:1.7.7:compile
>> |  |  |  \- ch.qos.logback:logback-classic:jar:1.1.2:compile
>> |  |  |     \- ch.qos.logback:logback-core:jar:1.1.2:compile
>> |  |  \- org.yaml:snakeyaml:jar:1.13:runtime
>> |  +-
>> org.springframework.boot:spring-boot-starter-aop:jar:1.0.2.RELEASE:compile
>> |  |  \- org.aspectj:aspectjweaver:jar:1.7.4:compile
>> |  +- org.springframework:spring-core:jar:4.0.3.RELEASE:compile
>> |  +-
>> org.springframework.boot:spring-boot-starter-jdbc:jar:1.0.2.RELEASE:compile
>> |  |  +- org.springframework:spring-jdbc:jar:4.0.3.RELEASE:compile
>> |  |  \- org.apache.tomcat:tomcat-jdbc:jar:7.0.52:compile
>> |  |     \- org.apache.tomcat:tomcat-juli:jar:7.0.52:compile
>> |  +- org.springframework:spring-orm:jar:4.0.3.RELEASE:compile
>> |  \- org.springframework:spring-aspects:jar:4.0.3.RELEASE:compile
>> +- com.fasterxml.jackson.core:jackson-databind:jar:2.3.3:compile
>> |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.3.0:compile
>> |  \- com.fasterxml.jackson.core:jackson-core:jar:2.3.3:compile
>> +- org.springframework.data:spring-data-jpa:jar:1.6.1.RELEASE:compile
>> |  +-
>> org.springframework.data:spring-data-commons:jar:1.8.1.RELEASE:compile
>> |  +- org.springframework:spring-context:jar:4.0.3.RELEASE:compile
>> |  |  \- org.springframework:spring-expression:jar:4.0.3.RELEASE:compile
>> |  +- org.springframework:spring-tx:jar:4.0.3.RELEASE:compile
>> |  +- org.springframework:spring-beans:jar:4.0.3.RELEASE:compile
>> |  +- org.aspectj:aspectjrt:jar:1.7.4:compile
>> |  \- org.slf4j:slf4j-api:jar:1.7.7:compile
>> +- org.springframework.data:spring-data-redis:jar:1.3.2.RELEASE:compile
>> |  +- org.springframework:spring-context-support:jar:4.0.3.RELEASE:compile
>> |  \- org.springframework:spring-aop:jar:4.0.3.RELEASE:compile
>> |     \- aopalliance:aopalliance:jar:1.0:compile
>> +- org.hibernate:hibernate-entitymanager:jar:4.3.5.Final:runtime
>> |  +- org.jboss.logging:jboss-logging:jar:3.1.3.GA:runtime
>> |  +- org.jboss.logging:jboss-logging-annotations:jar:1.2.0.Beta1:runtime
>> |  +- org.hibernate:hibernate-core:jar:4.3.5.Final:runtime
>> |  |  +- antlr:antlr:jar:2.7.7:runtime
>> |  |  \- org.jboss:jandex:jar:1.1.0.Final:runtime
>> |  +- dom4j:dom4j:jar:1.6.1:runtime
>> |  |  \- xml-apis:xml-apis:jar:1.0.b2:runtime
>> |  +-
>> org.hibernate.common:hibernate-commons-annotations:jar:4.0.4.Final:runtime
>> |  +-
>> org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:runtime
>> |  +-
>> org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:jar:1.0.0.Final:runtime
>> |  \- org.javassist:javassist:jar:3.18.1-GA:runtime
>> +- redis.clients:jedis:jar:2.6.0:compile
>> |  \- org.apache.commons:commons-pool2:jar:2.0:compile
>> +- org.springframework:spring-web:jar:4.0.3.RELEASE:compile
>> +- commons-dbcp:commons-dbcp:jar:1.4:compile
>> |  \- commons-pool:commons-pool:jar:1.6:compile
>> +- junit:junit:jar:4.11:test
>> |  \- org.hamcrest:hamcrest-core:jar:1.3:test
>> +- org.mockito:mockito-core:jar:1.9.5:test
>> |  \- org.objenesis:objenesis:jar:1.0:test
>> \- org.hamcrest:hamcrest-library:jar:1.3:test
>>
>>
>> As you can see, you need to exclude it from
>>
>>
>>   Am Sun, 18 Jan 2015
>> 11:11:36 +0200 schrieb Yuval Zilberstein <yu...@gmail.com>:
>>
>>> Hi, I have the following pom.xml
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <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">
>>>
>>> <!-- in order to copy the dependencies, run: -->
>>> <!-- mvn clean dependency:copy-dependencies -->
>>> <modelVersion>4.0.0</modelVersion>
>>>
>>> <groupId>com.proonto</groupId>
>>> <artifactId>platform-common</artifactId>
>>> <version>1.0</version>
>>> <name>Proonto platform - common</name>
>>>   <parent>
>>>      <groupId>org.springframework.boot</groupId>
>>>      <artifactId>spring-boot-starter-parent</artifactId>
>>>      <version>1.0.2.RELEASE</version>
>>> </parent>
>>>   <dependencies>
>>> <dependency>
>>>    <groupId>org.springframework.boot</groupId>
>>> <artifactId>spring-boot-starter-data-jpa</artifactId>
>>>    <version>1.1.4.RELEASE</version>
>>>          <exclusions>
>>>          <exclusion>
>>> <!-- We already import it in a project that this project depends on
>>> --> <groupId>org.slf4j</groupId>
>>>          <artifactId>jcl-over-slf4j</artifactId>
>>>          </exclusion>
>>>          <exclusion>
>>> <!-- We already import it in a project that this project depends on
>>> --> <groupId>org.springframework</groupId>
>>>          <artifactId>spring-aop</artifactId>
>>>          </exclusion>
>>>          </exclusions>
>>> </dependency>
>>> <dependency>
>>> <groupId>com.fasterxml.jackson.core</groupId>
>>> <artifactId>jackson-databind</artifactId>
>>> <version>2.3.3</version>
>>> </dependency>
>>> <dependency>
>>>          <groupId>org.springframework.data</groupId>
>>>          <artifactId>spring-data-jpa</artifactId>
>>>          <version>1.6.1.RELEASE</version>
>>>          <exclusions>
>>> <exclusion>
>>> <!-- We already import it in a project that this project depends on
>>> --> <groupId>aopalliance</groupId>
>>> <artifactId>aopalliance</artifactId>
>>> </exclusion>
>>>          <exclusion>
>>> <!-- We already import it in a project that this project depends on
>>> --> <groupId>org.slf4j</groupId>
>>>          <artifactId>jcl-over-slf4j</artifactId>
>>>          </exclusion>
>>>          <exclusion>
>>> <!-- We already import it in a project that this project depends on
>>> --> <groupId>org.springframework</groupId>
>>>          <artifactId>spring-aop</artifactId>
>>>          </exclusion>
>>>          </exclusions>
>>>      </dependency>
>>>      <dependency>
>>>          <groupId>org.springframework.data</groupId>
>>>          <artifactId>spring-data-redis</artifactId>
>>>          <version>1.3.2.RELEASE</version>
>>> *        <exclusions>*
>>> *        <exclusion>*
>>> * <!-- We already import it in a project that this project depends on
>>> -->*
>>> *        <groupId>org.springframework</groupId>*
>>> *        <artifactId>spring-aop</artifactId>*
>>> *        </exclusion>*
>>> * <exclusion>*
>>> * <!-- We already import it in a project that this project depends on
>>> -->*
>>> * <groupId>aopalliance</groupId>*
>>> * <artifactId>aopalliance</artifactId>*
>>> * </exclusion>*
>>> *        </exclusions>*
>>>      </dependency>
>>>      <dependency>
>>>      <groupId>org.hibernate</groupId>
>>>      <artifactId>hibernate-entitymanager</artifactId>
>>>      <version>4.3.5.Final</version>
>>>      <scope>runtime</scope>
>>> </dependency>
>>> <dependency>
>>> <groupId>redis.clients</groupId>
>>> <artifactId>jedis</artifactId>
>>> <version>2.6.0</version>
>>> </dependency>
>>> <dependency>
>>>          <groupId>org.springframework.data</groupId>
>>>          <artifactId>spring-data-redis</artifactId>
>>>          <version>1.3.2.RELEASE</version>
>>>      </dependency>
>>>      <dependency>
>>>          <groupId>org.springframework</groupId>
>>>          <artifactId>spring-web</artifactId>
>>>          <version>4.0.3.RELEASE</version>
>>>          <exclusions>
>>>          <exclusion>
>>> <!-- We already import it in a project that this project depends on
>>> --> <groupId>org.springframework</groupId>
>>>          <artifactId>spring-aop</artifactId>
>>>          </exclusion>
>>>          </exclusions>
>>>      </dependency>
>>> <dependency>
>>> <groupId>commons-dbcp</groupId>
>>> <artifactId>commons-dbcp</artifactId>
>>> <version>1.4</version>
>>> </dependency>
>>> </dependencies>
>>>
>>> <build>
>>> <plugins>
>>> <plugin>
>>> <groupId>org.apache.maven.plugins</groupId>
>>> <artifactId>maven-dependency-plugin</artifactId>
>>> <configuration>
>>> <outputDirectory>./WebContent/WEB-INF/lib</outputDirectory>
>>> </configuration>
>>>            </plugin>
>>> </plugins>
>>> </build>
>>>
>>> </project>
>>>
>>> When i run: mvn -X clean dependency:copy-dependencies
>>> maven brings the aopalliance and spring-aop jars, though i
>>> specifically exclude it.
>>> I bolded the section that is being ignored.
>>> Thanks Yuval
>>>
>>>
>>>
>>>
>>
>


-- 
Ron Wheeler
President
Artifact Software Inc
email: rwheeler@artifact-software.com
skype: ronaldmwheeler
phone: 866-970-2435, ext 102


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


Re: Maven does not respect exclusion

Posted by Yuval Zilberstein <yu...@gmail.com>.
Thanks Bernd,
I found that i mistakenly added the redis dependency twice,
so excluding dependencies on one did not exclude them from the other.
This is one of the mistakes that when you discover them you ask yourself
how didn't i notice that before.


On Sun, Jan 18, 2015 at 8:03 PM, Bernd Eckenfels <ec...@zusammenkunft.net>
wrote:

> Hello,
>
> you need to exclude them from all direct dependencies which can drag it
> in. For this the dependency:tree is a good tool. As you can see, it gets
> dragged in by
>
>                 <dependency>
>                         <groupId>org.springframework.data</groupId>
>                         <artifactId>spring-data-redis</artifactId>
>                         <version>1.3.2.RELEASE</version>
>                 </dependency>
>
> Gruss
> Bernd
>
> BTW: if you did not enter the * into the pom it would have taken me less
> time to reproduce it. It is alwas a  good idea to add a link to a useable
> file, thanks!
>
>
> com.proonto:platform-common:jar:1.0
> +-
> org.springframework.boot:spring-boot-starter-data-jpa:jar:1.1.4.RELEASE:compile
> |  +-
> org.springframework.boot:spring-boot-starter:jar:1.0.2.RELEASE:compile
> |  |  +- org.springframework.boot:spring-boot:jar:1.0.2.RELEASE:compile
> |  |  +-
> org.springframework.boot:spring-boot-autoconfigure:jar:1.0.2.RELEASE:compile
> |  |  +-
> org.springframework.boot:spring-boot-starter-logging:jar:1.0.2.RELEASE:compile
> |  |  |  +- org.slf4j:jul-to-slf4j:jar:1.7.7:compile
> |  |  |  +- org.slf4j:log4j-over-slf4j:jar:1.7.7:compile
> |  |  |  \- ch.qos.logback:logback-classic:jar:1.1.2:compile
> |  |  |     \- ch.qos.logback:logback-core:jar:1.1.2:compile
> |  |  \- org.yaml:snakeyaml:jar:1.13:runtime
> |  +-
> org.springframework.boot:spring-boot-starter-aop:jar:1.0.2.RELEASE:compile
> |  |  \- org.aspectj:aspectjweaver:jar:1.7.4:compile
> |  +- org.springframework:spring-core:jar:4.0.3.RELEASE:compile
> |  +-
> org.springframework.boot:spring-boot-starter-jdbc:jar:1.0.2.RELEASE:compile
> |  |  +- org.springframework:spring-jdbc:jar:4.0.3.RELEASE:compile
> |  |  \- org.apache.tomcat:tomcat-jdbc:jar:7.0.52:compile
> |  |     \- org.apache.tomcat:tomcat-juli:jar:7.0.52:compile
> |  +- org.springframework:spring-orm:jar:4.0.3.RELEASE:compile
> |  \- org.springframework:spring-aspects:jar:4.0.3.RELEASE:compile
> +- com.fasterxml.jackson.core:jackson-databind:jar:2.3.3:compile
> |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.3.0:compile
> |  \- com.fasterxml.jackson.core:jackson-core:jar:2.3.3:compile
> +- org.springframework.data:spring-data-jpa:jar:1.6.1.RELEASE:compile
> |  +-
> org.springframework.data:spring-data-commons:jar:1.8.1.RELEASE:compile
> |  +- org.springframework:spring-context:jar:4.0.3.RELEASE:compile
> |  |  \- org.springframework:spring-expression:jar:4.0.3.RELEASE:compile
> |  +- org.springframework:spring-tx:jar:4.0.3.RELEASE:compile
> |  +- org.springframework:spring-beans:jar:4.0.3.RELEASE:compile
> |  +- org.aspectj:aspectjrt:jar:1.7.4:compile
> |  \- org.slf4j:slf4j-api:jar:1.7.7:compile
> +- org.springframework.data:spring-data-redis:jar:1.3.2.RELEASE:compile
> |  +- org.springframework:spring-context-support:jar:4.0.3.RELEASE:compile
> |  \- org.springframework:spring-aop:jar:4.0.3.RELEASE:compile
> |     \- aopalliance:aopalliance:jar:1.0:compile
> +- org.hibernate:hibernate-entitymanager:jar:4.3.5.Final:runtime
> |  +- org.jboss.logging:jboss-logging:jar:3.1.3.GA:runtime
> |  +- org.jboss.logging:jboss-logging-annotations:jar:1.2.0.Beta1:runtime
> |  +- org.hibernate:hibernate-core:jar:4.3.5.Final:runtime
> |  |  +- antlr:antlr:jar:2.7.7:runtime
> |  |  \- org.jboss:jandex:jar:1.1.0.Final:runtime
> |  +- dom4j:dom4j:jar:1.6.1:runtime
> |  |  \- xml-apis:xml-apis:jar:1.0.b2:runtime
> |  +-
> org.hibernate.common:hibernate-commons-annotations:jar:4.0.4.Final:runtime
> |  +-
> org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:runtime
> |  +-
> org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:jar:1.0.0.Final:runtime
> |  \- org.javassist:javassist:jar:3.18.1-GA:runtime
> +- redis.clients:jedis:jar:2.6.0:compile
> |  \- org.apache.commons:commons-pool2:jar:2.0:compile
> +- org.springframework:spring-web:jar:4.0.3.RELEASE:compile
> +- commons-dbcp:commons-dbcp:jar:1.4:compile
> |  \- commons-pool:commons-pool:jar:1.6:compile
> +- junit:junit:jar:4.11:test
> |  \- org.hamcrest:hamcrest-core:jar:1.3:test
> +- org.mockito:mockito-core:jar:1.9.5:test
> |  \- org.objenesis:objenesis:jar:1.0:test
> \- org.hamcrest:hamcrest-library:jar:1.3:test
>
>
> As you can see, you need to exclude it from
>
>
>  Am Sun, 18 Jan 2015
> 11:11:36 +0200 schrieb Yuval Zilberstein <yu...@gmail.com>:
>
> > Hi, I have the following pom.xml
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <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">
> >
> > <!-- in order to copy the dependencies, run: -->
> > <!-- mvn clean dependency:copy-dependencies -->
> > <modelVersion>4.0.0</modelVersion>
> >
> > <groupId>com.proonto</groupId>
> > <artifactId>platform-common</artifactId>
> > <version>1.0</version>
> > <name>Proonto platform - common</name>
> >  <parent>
> >     <groupId>org.springframework.boot</groupId>
> >     <artifactId>spring-boot-starter-parent</artifactId>
> >     <version>1.0.2.RELEASE</version>
> > </parent>
> >  <dependencies>
> > <dependency>
> >   <groupId>org.springframework.boot</groupId>
> > <artifactId>spring-boot-starter-data-jpa</artifactId>
> >   <version>1.1.4.RELEASE</version>
> >         <exclusions>
> >         <exclusion>
> > <!-- We already import it in a project that this project depends on
> > --> <groupId>org.slf4j</groupId>
> >         <artifactId>jcl-over-slf4j</artifactId>
> >         </exclusion>
> >         <exclusion>
> > <!-- We already import it in a project that this project depends on
> > --> <groupId>org.springframework</groupId>
> >         <artifactId>spring-aop</artifactId>
> >         </exclusion>
> >         </exclusions>
> > </dependency>
> > <dependency>
> > <groupId>com.fasterxml.jackson.core</groupId>
> > <artifactId>jackson-databind</artifactId>
> > <version>2.3.3</version>
> > </dependency>
> > <dependency>
> >         <groupId>org.springframework.data</groupId>
> >         <artifactId>spring-data-jpa</artifactId>
> >         <version>1.6.1.RELEASE</version>
> >         <exclusions>
> > <exclusion>
> > <!-- We already import it in a project that this project depends on
> > --> <groupId>aopalliance</groupId>
> > <artifactId>aopalliance</artifactId>
> > </exclusion>
> >         <exclusion>
> > <!-- We already import it in a project that this project depends on
> > --> <groupId>org.slf4j</groupId>
> >         <artifactId>jcl-over-slf4j</artifactId>
> >         </exclusion>
> >         <exclusion>
> > <!-- We already import it in a project that this project depends on
> > --> <groupId>org.springframework</groupId>
> >         <artifactId>spring-aop</artifactId>
> >         </exclusion>
> >         </exclusions>
> >     </dependency>
> >     <dependency>
> >         <groupId>org.springframework.data</groupId>
> >         <artifactId>spring-data-redis</artifactId>
> >         <version>1.3.2.RELEASE</version>
> > *        <exclusions>*
> > *        <exclusion>*
> > * <!-- We already import it in a project that this project depends on
> > -->*
> > *        <groupId>org.springframework</groupId>*
> > *        <artifactId>spring-aop</artifactId>*
> > *        </exclusion>*
> > * <exclusion>*
> > * <!-- We already import it in a project that this project depends on
> > -->*
> > * <groupId>aopalliance</groupId>*
> > * <artifactId>aopalliance</artifactId>*
> > * </exclusion>*
> > *        </exclusions>*
> >     </dependency>
> >     <dependency>
> >     <groupId>org.hibernate</groupId>
> >     <artifactId>hibernate-entitymanager</artifactId>
> >     <version>4.3.5.Final</version>
> >     <scope>runtime</scope>
> > </dependency>
> > <dependency>
> > <groupId>redis.clients</groupId>
> > <artifactId>jedis</artifactId>
> > <version>2.6.0</version>
> > </dependency>
> > <dependency>
> >         <groupId>org.springframework.data</groupId>
> >         <artifactId>spring-data-redis</artifactId>
> >         <version>1.3.2.RELEASE</version>
> >     </dependency>
> >     <dependency>
> >         <groupId>org.springframework</groupId>
> >         <artifactId>spring-web</artifactId>
> >         <version>4.0.3.RELEASE</version>
> >         <exclusions>
> >         <exclusion>
> > <!-- We already import it in a project that this project depends on
> > --> <groupId>org.springframework</groupId>
> >         <artifactId>spring-aop</artifactId>
> >         </exclusion>
> >         </exclusions>
> >     </dependency>
> > <dependency>
> > <groupId>commons-dbcp</groupId>
> > <artifactId>commons-dbcp</artifactId>
> > <version>1.4</version>
> > </dependency>
> > </dependencies>
> >
> > <build>
> > <plugins>
> > <plugin>
> > <groupId>org.apache.maven.plugins</groupId>
> > <artifactId>maven-dependency-plugin</artifactId>
> > <configuration>
> > <outputDirectory>./WebContent/WEB-INF/lib</outputDirectory>
> > </configuration>
> >           </plugin>
> > </plugins>
> > </build>
> >
> > </project>
> >
> > When i run: mvn -X clean dependency:copy-dependencies
> > maven brings the aopalliance and spring-aop jars, though i
> > specifically exclude it.
> > I bolded the section that is being ignored.
> > Thanks Yuval
> >
> >
> >
> >
>
>


-- 
*Yuval Zilberstein*
*Join me online: **Facebook*
<http://www.facebook.com/people/Yuval-Zilberstein/100001194762863> I *Linkdln
<http://il.linkedin.com/pub/yuval-zilberstein/13/6b1/773>* I Google+
<https://plus.google.com/s/yuval%20zilberstein>
*mailto:yuvalzi@gmail.com <yu...@gmail.com>*
*Please consider the impact on the environment before printing this e-mail.*

Re: Maven does not respect exclusion

Posted by Bernd Eckenfels <ec...@zusammenkunft.net>.
Hello,

you need to exclude them from all direct dependencies which can drag it
in. For this the dependency:tree is a good tool. As you can see, it gets dragged in by 

		<dependency>
			<groupId>org.springframework.data</groupId>
			<artifactId>spring-data-redis</artifactId>
			<version>1.3.2.RELEASE</version>
		</dependency>

Gruss
Bernd

BTW: if you did not enter the * into the pom it would have taken me less time to reproduce it. It is alwas a  good idea to add a link to a useable file, thanks!


com.proonto:platform-common:jar:1.0
+- org.springframework.boot:spring-boot-starter-data-jpa:jar:1.1.4.RELEASE:compile
|  +- org.springframework.boot:spring-boot-starter:jar:1.0.2.RELEASE:compile
|  |  +- org.springframework.boot:spring-boot:jar:1.0.2.RELEASE:compile
|  |  +- org.springframework.boot:spring-boot-autoconfigure:jar:1.0.2.RELEASE:compile
|  |  +- org.springframework.boot:spring-boot-starter-logging:jar:1.0.2.RELEASE:compile
|  |  |  +- org.slf4j:jul-to-slf4j:jar:1.7.7:compile
|  |  |  +- org.slf4j:log4j-over-slf4j:jar:1.7.7:compile
|  |  |  \- ch.qos.logback:logback-classic:jar:1.1.2:compile
|  |  |     \- ch.qos.logback:logback-core:jar:1.1.2:compile
|  |  \- org.yaml:snakeyaml:jar:1.13:runtime
|  +- org.springframework.boot:spring-boot-starter-aop:jar:1.0.2.RELEASE:compile
|  |  \- org.aspectj:aspectjweaver:jar:1.7.4:compile
|  +- org.springframework:spring-core:jar:4.0.3.RELEASE:compile
|  +- org.springframework.boot:spring-boot-starter-jdbc:jar:1.0.2.RELEASE:compile
|  |  +- org.springframework:spring-jdbc:jar:4.0.3.RELEASE:compile
|  |  \- org.apache.tomcat:tomcat-jdbc:jar:7.0.52:compile
|  |     \- org.apache.tomcat:tomcat-juli:jar:7.0.52:compile
|  +- org.springframework:spring-orm:jar:4.0.3.RELEASE:compile
|  \- org.springframework:spring-aspects:jar:4.0.3.RELEASE:compile
+- com.fasterxml.jackson.core:jackson-databind:jar:2.3.3:compile
|  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.3.0:compile
|  \- com.fasterxml.jackson.core:jackson-core:jar:2.3.3:compile
+- org.springframework.data:spring-data-jpa:jar:1.6.1.RELEASE:compile
|  +- org.springframework.data:spring-data-commons:jar:1.8.1.RELEASE:compile
|  +- org.springframework:spring-context:jar:4.0.3.RELEASE:compile
|  |  \- org.springframework:spring-expression:jar:4.0.3.RELEASE:compile
|  +- org.springframework:spring-tx:jar:4.0.3.RELEASE:compile
|  +- org.springframework:spring-beans:jar:4.0.3.RELEASE:compile
|  +- org.aspectj:aspectjrt:jar:1.7.4:compile
|  \- org.slf4j:slf4j-api:jar:1.7.7:compile
+- org.springframework.data:spring-data-redis:jar:1.3.2.RELEASE:compile
|  +- org.springframework:spring-context-support:jar:4.0.3.RELEASE:compile
|  \- org.springframework:spring-aop:jar:4.0.3.RELEASE:compile
|     \- aopalliance:aopalliance:jar:1.0:compile
+- org.hibernate:hibernate-entitymanager:jar:4.3.5.Final:runtime
|  +- org.jboss.logging:jboss-logging:jar:3.1.3.GA:runtime
|  +- org.jboss.logging:jboss-logging-annotations:jar:1.2.0.Beta1:runtime
|  +- org.hibernate:hibernate-core:jar:4.3.5.Final:runtime
|  |  +- antlr:antlr:jar:2.7.7:runtime
|  |  \- org.jboss:jandex:jar:1.1.0.Final:runtime
|  +- dom4j:dom4j:jar:1.6.1:runtime
|  |  \- xml-apis:xml-apis:jar:1.0.b2:runtime
|  +- org.hibernate.common:hibernate-commons-annotations:jar:4.0.4.Final:runtime
|  +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:runtime
|  +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:jar:1.0.0.Final:runtime
|  \- org.javassist:javassist:jar:3.18.1-GA:runtime
+- redis.clients:jedis:jar:2.6.0:compile
|  \- org.apache.commons:commons-pool2:jar:2.0:compile
+- org.springframework:spring-web:jar:4.0.3.RELEASE:compile
+- commons-dbcp:commons-dbcp:jar:1.4:compile
|  \- commons-pool:commons-pool:jar:1.6:compile
+- junit:junit:jar:4.11:test
|  \- org.hamcrest:hamcrest-core:jar:1.3:test
+- org.mockito:mockito-core:jar:1.9.5:test
|  \- org.objenesis:objenesis:jar:1.0:test
\- org.hamcrest:hamcrest-library:jar:1.3:test


As you can see, you need to exclude it from 


 Am Sun, 18 Jan 2015
11:11:36 +0200 schrieb Yuval Zilberstein <yu...@gmail.com>:

> Hi, I have the following pom.xml
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <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">
> 
> <!-- in order to copy the dependencies, run: -->
> <!-- mvn clean dependency:copy-dependencies -->
> <modelVersion>4.0.0</modelVersion>
> 
> <groupId>com.proonto</groupId>
> <artifactId>platform-common</artifactId>
> <version>1.0</version>
> <name>Proonto platform - common</name>
>  <parent>
>     <groupId>org.springframework.boot</groupId>
>     <artifactId>spring-boot-starter-parent</artifactId>
>     <version>1.0.2.RELEASE</version>
> </parent>
>  <dependencies>
> <dependency>
>   <groupId>org.springframework.boot</groupId>
> <artifactId>spring-boot-starter-data-jpa</artifactId>
>   <version>1.1.4.RELEASE</version>
>         <exclusions>
>         <exclusion>
> <!-- We already import it in a project that this project depends on
> --> <groupId>org.slf4j</groupId>
>         <artifactId>jcl-over-slf4j</artifactId>
>         </exclusion>
>         <exclusion>
> <!-- We already import it in a project that this project depends on
> --> <groupId>org.springframework</groupId>
>         <artifactId>spring-aop</artifactId>
>         </exclusion>
>         </exclusions>
> </dependency>
> <dependency>
> <groupId>com.fasterxml.jackson.core</groupId>
> <artifactId>jackson-databind</artifactId>
> <version>2.3.3</version>
> </dependency>
> <dependency>
>         <groupId>org.springframework.data</groupId>
>         <artifactId>spring-data-jpa</artifactId>
>         <version>1.6.1.RELEASE</version>
>         <exclusions>
> <exclusion>
> <!-- We already import it in a project that this project depends on
> --> <groupId>aopalliance</groupId>
> <artifactId>aopalliance</artifactId>
> </exclusion>
>         <exclusion>
> <!-- We already import it in a project that this project depends on
> --> <groupId>org.slf4j</groupId>
>         <artifactId>jcl-over-slf4j</artifactId>
>         </exclusion>
>         <exclusion>
> <!-- We already import it in a project that this project depends on
> --> <groupId>org.springframework</groupId>
>         <artifactId>spring-aop</artifactId>
>         </exclusion>
>         </exclusions>
>     </dependency>
>     <dependency>
>         <groupId>org.springframework.data</groupId>
>         <artifactId>spring-data-redis</artifactId>
>         <version>1.3.2.RELEASE</version>
> *        <exclusions>*
> *        <exclusion>*
> * <!-- We already import it in a project that this project depends on
> -->*
> *        <groupId>org.springframework</groupId>*
> *        <artifactId>spring-aop</artifactId>*
> *        </exclusion>*
> * <exclusion>*
> * <!-- We already import it in a project that this project depends on
> -->*
> * <groupId>aopalliance</groupId>*
> * <artifactId>aopalliance</artifactId>*
> * </exclusion>*
> *        </exclusions>*
>     </dependency>
>     <dependency>
>     <groupId>org.hibernate</groupId>
>     <artifactId>hibernate-entitymanager</artifactId>
>     <version>4.3.5.Final</version>
>     <scope>runtime</scope>
> </dependency>
> <dependency>
> <groupId>redis.clients</groupId>
> <artifactId>jedis</artifactId>
> <version>2.6.0</version>
> </dependency>
> <dependency>
>         <groupId>org.springframework.data</groupId>
>         <artifactId>spring-data-redis</artifactId>
>         <version>1.3.2.RELEASE</version>
>     </dependency>
>     <dependency>
>         <groupId>org.springframework</groupId>
>         <artifactId>spring-web</artifactId>
>         <version>4.0.3.RELEASE</version>
>         <exclusions>
>         <exclusion>
> <!-- We already import it in a project that this project depends on
> --> <groupId>org.springframework</groupId>
>         <artifactId>spring-aop</artifactId>
>         </exclusion>
>         </exclusions>
>     </dependency>
> <dependency>
> <groupId>commons-dbcp</groupId>
> <artifactId>commons-dbcp</artifactId>
> <version>1.4</version>
> </dependency>
> </dependencies>
> 
> <build>
> <plugins>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-dependency-plugin</artifactId>
> <configuration>
> <outputDirectory>./WebContent/WEB-INF/lib</outputDirectory>
> </configuration>
>           </plugin>
> </plugins>
> </build>
> 
> </project>
> 
> When i run: mvn -X clean dependency:copy-dependencies
> maven brings the aopalliance and spring-aop jars, though i
> specifically exclude it.
> I bolded the section that is being ignored.
> Thanks Yuval
> 
> 
> 
> 


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