Reputation: 85
I want to exclude google-collection jar which is getting download even after using exclude tag. SO that whenever I execute "mvn clean install" google-collections.jar should not be download.
I tried to add exclude in all dependencies still whenever I execute mvn clean install google-collection jar downloaded.
I also tried to manually delete jar file from m2 repo and then run mvn clean install. It downloads again.
<dependencies>
<dependency>
<groupId>net.rcarz</groupId>
<artifactId>jira-client</artifactId>
<version>0.5</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>com.google.collections</groupId>
<artifactId>google-collections</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.37</version>
<exclusions>
<exclusion>
<groupId>com.google.collections</groupId>
<artifactId>google-collections</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.twitter4j</groupId>
<artifactId>twitter4j-core</artifactId>
<version>[4.0,)</version>
</dependency>
<dependency>
<groupId>net.sf.opencsv</groupId>
<artifactId>opencsv</artifactId>
<version>2.3</version>
<exclusions>
<exclusion>
<groupId>com.google.collections</groupId>
<artifactId>google-collections</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>[2,)</version>
<exclusions>
<exclusion>
<groupId>com.google.collections</groupId>
<artifactId>google-collections</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>[4,)</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.3</version>
<exclusions>
<exclusion>
<groupId>com.google.collections</groupId>
<artifactId>google-collections</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8.5</version>
<exclusions>
<exclusion>
<groupId>com.google.collections</groupId>
<artifactId>google-collections</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.uncommons</groupId>
<artifactId>reportng</artifactId>
<version>1.1.4</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.collections</groupId>
<artifactId>google-collections</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>velocity</groupId>
<artifactId>velocity</artifactId>
<version>1.4</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>com.google.collections</groupId>
<artifactId>google-collections</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<exclusions>
<exclusion>
<groupId>com.google.collections</groupId>
<artifactId>google-collections</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.8.1</version>
<exclusions>
<exclusion>
<groupId>com.google.collections</groupId>
<artifactId>google-collections</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.9</version>
<exclusions>
<exclusion>
<groupId>com.google.collections</groupId>
<artifactId>google-collections</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.11.0</version>
<exclusions>
<exclusion>
<groupId>com.google.collections</groupId>
<artifactId>google-collections</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-firefox-driver</artifactId>
<version>3.11.0</version>
<exclusions>
<exclusion>
<groupId>com.google.collections</groupId>
<artifactId>google-collections</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>3.11.0</version>
<exclusions>
<exclusion>
<groupId>com.google.collections</groupId>
<artifactId>google-collections</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>htmlunit-driver</artifactId>
<version>2.29.0</version>
<exclusions>
<exclusion>
<groupId>com.google.collections</groupId>
<artifactId>google-collections</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>1.4.01</version>
<exclusions>
<exclusion>
<groupId>com.google.collections</groupId>
<artifactId>google-collections</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
<exclusions>
<exclusion>
<groupId>com.google.collections</groupId>
<artifactId>google-collections</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.11</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.3</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>23.0</version>
<exclusions>
<exclusion>
<groupId>com.google.collections</groupId>
<artifactId>google-collections</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<profiles>
With this since I have excluded google-Collection it's Jar should not download.
But it download google-collection jar .
I have no clued and frustrated by trying all combination. It would be great if some one can also explain why this is not working and which dependency is downloading google-collection jar .
I commented out guava dependency and execute mvn clean install. It downloads google collection jar.
Upvotes: 0
Views: 2132
Reputation: 25
For the exclusion of Guava jdk5 try putting it like this
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava-jdk5</artifactId>
</exclusion>
</exclusions>
Upvotes: 0
Reputation: 35427
I checked your dependencies and you do not have google-collections
as a dependency.
However, you have guava
which is the successor of google-collections
. But that dependency is explicitly requested by you as your last dependency item.
However... If I remove all exclusions that you added in your pom.xml
file, there is indeed one dependency that relies on google-collections
: it's maven-surefire-report-plugin
(which is a plugin and shouldn't be a dependency), but... you accurately excluded google-collections
from its own dependencies! So google-collections
is totally absent.
You can check this by going in your project folder and typing:
mvn dependency:tree
The result of this is the following:
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ tmp ---
[INFO] com.example:tmp:jar:1.0-SNAPSHOT
[INFO] +- net.rcarz:jira-client:jar:0.5:compile
[INFO] | +- org.apache.httpcomponents:httpmime:jar:4.2.5:compile
[INFO] | +- net.sf.json-lib:json-lib:jar:jdk15:2.4:compile
[INFO] | | +- commons-beanutils:commons-beanutils:jar:1.8.0:compile
[INFO] | | +- commons-collections:commons-collections:jar:3.2.1:compile
[INFO] | | \- net.sf.ezmorph:ezmorph:jar:1.0.6:compile
[INFO] | +- junit:junit:jar:4.8.2:compile
[INFO] | +- org.mockito:mockito-all:jar:1.9.0:compile
[INFO] | \- commons-httpclient:commons-httpclient:jar:3.1:compile
[INFO] +- mysql:mysql-connector-java:jar:5.1.37:compile
[INFO] +- org.twitter4j:twitter4j-core:jar:4.0.7:compile
[INFO] +- net.sf.opencsv:opencsv:jar:2.3:compile
[INFO] +- org.apache.maven.plugins:maven-surefire-report-plugin:jar:3.0.0-M3:compile
[INFO] | +- org.apache.maven.surefire:surefire-report-parser:jar:3.0.0-M3:compile
[INFO] | | +- org.apache.maven.surefire:surefire-logger-api:jar:3.0.0-M3:compile
[INFO] | | \- org.apache.maven.reporting:maven-reporting-api:jar:3.0:compile
[INFO] | +- org.apache.maven:maven-plugin-api:jar:3.0:compile
[INFO] | | +- org.apache.maven:maven-model:jar:3.0:compile
[INFO] | | +- org.apache.maven:maven-artifact:jar:3.0:compile
[INFO] | | \- org.sonatype.sisu:sisu-inject-plexus:jar:1.4.2:compile
[INFO] | | +- org.codehaus.plexus:plexus-classworlds:jar:2.2.3:compile
[INFO] | | \- org.sonatype.sisu:sisu-inject-bean:jar:1.4.2:compile
[INFO] | | \- org.sonatype.sisu:sisu-guice:jar:noaop:2.1.7:compile
[INFO] | +- org.apache.maven.reporting:maven-reporting-impl:jar:3.0.0:compile
[INFO] | | +- org.apache.maven:maven-core:jar:3.0:compile
[INFO] | | | +- org.apache.maven:maven-settings:jar:3.0:compile
[INFO] | | | +- org.apache.maven:maven-settings-builder:jar:3.0:compile
[INFO] | | | +- org.apache.maven:maven-repository-metadata:jar:3.0:compile
[INFO] | | | +- org.apache.maven:maven-model-builder:jar:3.0:compile
[INFO] | | | +- org.apache.maven:maven-aether-provider:jar:3.0:runtime
[INFO] | | | +- org.sonatype.aether:aether-impl:jar:1.7:compile
[INFO] | | | | \- org.sonatype.aether:aether-spi:jar:1.7:compile
[INFO] | | | +- org.sonatype.aether:aether-api:jar:1.7:compile
[INFO] | | | +- org.sonatype.aether:aether-util:jar:1.7:compile
[INFO] | | | +- org.codehaus.plexus:plexus-interpolation:jar:1.14:compile
[INFO] | | | \- org.sonatype.plexus:plexus-sec-dispatcher:jar:1.3:compile
[INFO] | | | \- org.sonatype.plexus:plexus-cipher:jar:1.4:compile
[INFO] | | +- org.apache.maven.shared:maven-shared-utils:jar:3.2.0:compile
[INFO] | | \- org.codehaus.plexus:plexus-utils:jar:3.0.24:compile
[INFO] | +- org.apache.maven.doxia:doxia-sink-api:jar:1.8:compile
[INFO] | | \- org.apache.maven.doxia:doxia-logging-api:jar:1.8:compile
[INFO] | +- org.apache.maven.doxia:doxia-decoration-model:jar:1.8.1:compile
[INFO] | | \- org.codehaus.plexus:plexus-component-annotations:jar:1.6:compile
[INFO] | +- org.apache.maven.doxia:doxia-core:jar:1.8:compile
[INFO] | | \- org.codehaus.plexus:plexus-container-default:jar:1.7.1:compile
[INFO] | | \- org.apache.xbean:xbean-reflect:jar:3.7:compile
[INFO] | +- org.apache.maven.doxia:doxia-site-renderer:jar:1.8.1:compile
[INFO] | | +- org.apache.maven.doxia:doxia-skin-model:jar:1.8.1:compile
[INFO] | | +- org.apache.maven.doxia:doxia-module-xhtml:jar:1.8:compile
[INFO] | | +- org.codehaus.plexus:plexus-i18n:jar:1.0-beta-7:compile
[INFO] | | +- org.codehaus.plexus:plexus-velocity:jar:1.2:compile
[INFO] | | +- org.apache.velocity:velocity:jar:1.7:compile
[INFO] | | \- org.apache.velocity:velocity-tools:jar:2.0:compile
[INFO] | | +- commons-digester:commons-digester:jar:1.8:compile
[INFO] | | +- commons-chain:commons-chain:jar:1.1:compile
[INFO] | | +- commons-validator:commons-validator:jar:1.3.1:compile
[INFO] | | +- oro:oro:jar:2.0.8:compile
[INFO] | | +- sslext:sslext:jar:1.2-0:compile
[INFO] | | +- org.apache.struts:struts-core:jar:1.3.8:compile
[INFO] | | | \- antlr:antlr:jar:2.7.2:compile
[INFO] | | +- org.apache.struts:struts-taglib:jar:1.3.8:compile
[INFO] | | \- org.apache.struts:struts-tiles:jar:1.3.8:compile
[INFO] | \- commons-lang:commons-lang:jar:2.6:compile
[INFO] +- org.apache.httpcomponents:httpclient:jar:4.5.7:compile
[INFO] | +- org.apache.httpcomponents:httpcore:jar:4.4.11:compile
[INFO] | \- commons-codec:commons-codec:jar:1.11:compile
[INFO] +- commons-logging:commons-logging:jar:1.1.3:compile
[INFO] +- org.testng:testng:jar:6.8.5:compile
[INFO] | +- org.beanshell:bsh:jar:2.0b4:compile
[INFO] | +- com.beust:jcommander:jar:1.27:compile
[INFO] | \- org.yaml:snakeyaml:jar:1.6:compile
[INFO] +- org.uncommons:reportng:jar:1.1.4:test
[INFO] +- com.google.inject:guice:jar:3.0:test
[INFO] | +- javax.inject:javax.inject:jar:1:test
[INFO] | \- aopalliance:aopalliance:jar:1.0:test
[INFO] +- velocity:velocity:jar:1.4:test
[INFO] | \- velocity:velocity-dep:jar:1.4:test
[INFO] +- log4j:log4j:jar:1.2.17:compile
[INFO] +- org.jsoup:jsoup:jar:1.8.1:compile
[INFO] +- org.apache.poi:poi-ooxml:jar:3.9:compile
[INFO] | +- org.apache.poi:poi-ooxml-schemas:jar:3.9:compile
[INFO] | | \- org.apache.xmlbeans:xmlbeans:jar:2.3.0:compile
[INFO] | | \- stax:stax-api:jar:1.0.1:compile
[INFO] | \- dom4j:dom4j:jar:1.6.1:compile
[INFO] +- org.seleniumhq.selenium:selenium-java:jar:3.11.0:compile
[INFO] | +- org.seleniumhq.selenium:selenium-api:jar:3.11.0:compile
[INFO] | +- org.seleniumhq.selenium:selenium-chrome-driver:jar:3.11.0:compile
[INFO] | +- org.seleniumhq.selenium:selenium-edge-driver:jar:3.11.0:compile
[INFO] | +- org.seleniumhq.selenium:selenium-ie-driver:jar:3.11.0:compile
[INFO] | +- org.seleniumhq.selenium:selenium-opera-driver:jar:3.11.0:compile
[INFO] | +- org.seleniumhq.selenium:selenium-remote-driver:jar:3.11.0:compile
[INFO] | +- org.seleniumhq.selenium:selenium-safari-driver:jar:3.11.0:compile
[INFO] | +- org.seleniumhq.selenium:selenium-support:jar:3.11.0:compile
[INFO] | +- net.bytebuddy:byte-buddy:jar:1.7.9:compile
[INFO] | +- org.apache.commons:commons-exec:jar:1.3:compile
[INFO] | +- com.google.code.gson:gson:jar:2.8.2:compile
[INFO] | +- com.squareup.okhttp3:okhttp:jar:3.9.1:compile
[INFO] | \- com.squareup.okio:okio:jar:1.13.0:compile
[INFO] +- org.seleniumhq.selenium:selenium-firefox-driver:jar:3.11.0:compile
[INFO] +- org.seleniumhq.selenium:selenium-server:jar:3.11.0:compile
[INFO] | +- org.apache.commons:commons-lang3:jar:3.7:compile
[INFO] | +- org.apache.commons:commons-text:jar:1.1:compile
[INFO] | +- commons-io:commons-io:jar:2.6:compile
[INFO] | +- commons-net:commons-net:jar:3.6:compile
[INFO] | +- org.w3c.css:sac:jar:1.3:compile
[INFO] | +- net.sourceforge.cssparser:cssparser:jar:0.9.24:compile
[INFO] | +- net.sourceforge.htmlunit:htmlunit:jar:2.29:compile
[INFO] | +- net.sourceforge.htmlunit:htmlunit-core-js:jar:2.28:compile
[INFO] | +- net.sourceforge.htmlunit:neko-htmlunit:jar:2.28:compile
[INFO] | +- net.jcip:jcip-annotations:jar:1.0:compile
[INFO] | +- org.seleniumhq.selenium:jetty-repacked:jar:9.4.7.v20171121:compile
[INFO] | +- org.eclipse.jetty:jetty-client:jar:9.4.7.v20170914:compile
[INFO] | +- org.eclipse.jetty:jetty-http:jar:9.4.8.v20171121:compile
[INFO] | +- org.eclipse.jetty:jetty-io:jar:9.4.8.v20171121:compile
[INFO] | +- org.eclipse.jetty:jetty-util:jar:9.4.8.v20171121:compile
[INFO] | +- org.eclipse.jetty:jetty-xml:jar:9.4.7.v20170914:compile
[INFO] | +- javax.servlet:javax.servlet-api:jar:3.1.0:compile
[INFO] | +- org.eclipse.jetty.websocket:websocket-api:jar:9.4.7.v20170914:compile
[INFO] | +- org.eclipse.jetty.websocket:websocket-client:jar:9.4.7.v20170914:compile
[INFO] | +- org.eclipse.jetty.websocket:websocket-common:jar:9.4.7.v20170914:compile
[INFO] | +- xalan:serializer:jar:2.7.2:compile
[INFO] | +- xalan:xalan:jar:2.7.2:compile
[INFO] | \- xerces:xercesImpl:jar:2.11.0:compile
[INFO] +- org.seleniumhq.selenium:htmlunit-driver:jar:2.29.0:compile
[INFO] +- xml-apis:xml-apis:jar:1.4.01:compile
[INFO] +- com.googlecode.json-simple:json-simple:jar:1.1.1:compile
[INFO] +- org.apache.poi:poi:jar:3.11:compile
[INFO] +- joda-time:joda-time:jar:2.3:compile
[INFO] \- com.google.guava:guava:jar:23.0:compile
[INFO] +- com.google.code.findbugs:jsr305:jar:1.3.9:compile
[INFO] +- com.google.errorprone:error_prone_annotations:jar:2.0.18:compile
[INFO] +- com.google.j2objc:j2objc-annotations:jar:1.1:compile
[INFO] \- org.codehaus.mojo:animal-sniffer-annotations:jar:1.14:compile
As you can see, there are no indirect dependency names google-collections
.
So you very likely think about another issue, which makes you think that google-collections
is present and I'd very much prefer that you say why you think google-collections
is present even though it is not, because as it is, there are no issue.
Upvotes: 1
Reputation: 4507
The first time, when you do mvn clean install
it downloads all the dependencies present in the pom.xml and stores it in the .m2 repository. So, now when you are using the exclude tag, it wont have any change as the mentioned dependency is already present in your m2 repository.
So, you need to remove the jar from the m2 repository and for that you need to go your m2 repository and delete the that jar manually and now if you use exclude tag and do mvn clean install
, it would not be downloaded again.
To find the path to m2 repo, you can check: How to get the Maven local repo location?
Upvotes: 0