我想排除这是即使使用排除标记后获得下载谷歌收集罐中。这样,每当我执行“MVN全新安装”谷歌collections.jar不应该下载。
我尝试添加排除所有的依赖仍然每当我执行MVN全新安装谷歌收集的jar下载。
我也试图从M2回购手动删除jar文件,然后运行MVN全新安装。需要再次下载。
<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>
有了这个,因为我已经排除谷歌收集它的JAR应该下载。
但是,谷歌下载收集罐中。
我没有避让,并通过尝试所有组合沮丧。这将是巨大的,如果有一个人也可以解释为什么这不工作和依赖性下载谷歌收集罐中。
我注释掉番石榴依赖和执行MVN干净安装。它下载谷歌收集罐中。
我检查你的依赖,你没有google-collections
作为一个依赖。
但是,你有guava
这是google-collections
的继任者。但这种依赖是明确你的要求为你最后的依赖项。
不过......如果我删除您在pom.xml
文件添加所有排除,确实有一个依赖依赖google-collections
:这是maven-surefire-report-plugin
(这是一个插件,不应该依赖),但是...你准确地排除google-collections
从自己的依赖!所以google-collections
是完全不存在的。
你可以在你的项目文件夹,然后输入要检查:
mvn dependency:tree
这样做的结果是:
[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
正如你所看到的,有没有间接依赖性名google-collections
。
所以,你很可能会想到另外一个问题,它让你觉得google-collections
存在,我会非常喜欢,你说,为什么你认为google-collections
存在,即使它不是,因为它是没有问题的。
第一次,当你做mvn clean install
它下载所有存在于存储库中的.m2 pom.xml中,并将其存储的依赖关系。所以,现在当你使用的是排除标签,它不会有任何变化,因为提到的依赖已经存在于你的M2存储库。
所以,你需要删除从M2存储库的jar和你需要去您的M2存储库和手动,现在删除该JAR如果你使用排除标签并做mvn clean install
,它不会被再次下载。
为了找到路径平方米回购,您可以检查:How to get the Maven local repo location?