该项目包含具有相同存档名称的另一个依赖项

时间:2014-10-27 16:46:38

标签: eclipse dependency-management m2e m2e-wtp

我在我的标记中看到以下错误(以及其他一些错误):

Invalid classpath publish/export dependency C:/Users/LevineJ/.m2/repository/org/bouncycastle/bcmail-jdk14/1.38/bcmail-jdk14-1.38.jar.
The project contains another dependency with the same archive name.

当我进行快速搜索时,我会在两个位置找到bcmail-jdk14.1.jar

  • C:\用户\ LevineJ.m2 \库\ BouncyCastle的\ bcmail-JDK14 \ 138
  • C:\用户\ LevineJ.m2 \库\有机\ BouncyCastle的\ bcmail-JDK14 \ 1.38

从我对这个主题的阅读(各种帖子/文章),我认为这与我所看到的错误有关。有人可以提供一些信息: 1.这个错误是什么意思? 2.我将如何解决它?

如果有帮助,我正在使用:

  • Eclipse Java EE - Luna Service Release 1(4.4.1)
  • m2e插件
  • m2e-wtp plugin

mvn dependency:tree

的结果
C:\Users\LevineJ\Development\default-workspace\adweb>mvn dependency:tree
Picked up _JAVA_OPTIONS: -Dcom.gxs.common.configuration.proxy.envid=totcpa -Dcom.gxs.common.logging.configfilepath=C:\Users\LevineJ\Development\config\adweb\LogCfg.xml -Dcom.gxs.common.configuration.localenvid=adweb -Dcom.gxs.common.logging.sdklogfile=C:\Users\LevineJ\Development\config\adweb\tgo.log -Dcom.gxs.common.configuration.path=C:\Users\LevineJ\Development\config\adweb\CRC
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.gxs:adweb:war:${build.number}
[WARNING] 'version' contains an expression but should be a constant. @ line 9, column 11
[WARNING] 'build.plugins.plugin.version' for org.codehaus.mojo:tomcat-maven-plugin is missing. @ line 325, column 12
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building adweb ${build.number}
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for com.gxs:reportservice-client:jar:05.09.00.16 is missing, no dependency information available
[INFO]
[INFO] --- maven-dependency-plugin:2.3:tree (default-cli) @ adweb ---
[WARNING] Missing POM for com.gxs:reportservice-client:jar:05.09.00.16
[INFO] com.gxs:adweb:war:${build.number}
[INFO] +- com.opentext.ix.ad:adcommon:jar:LATEST:compile
[INFO] |  +- com.gxs.imclient:IMclient:jar:07.24.00.03:compile
[INFO] |  +- com.gxs.e2eui:wscommon:jar:1.0:compile
[INFO] |  |  +- org.apache.woden:woden-impl-dom:jar:1.0M8:compile
[INFO] |  |  |  +- org.apache.woden:woden-api:jar:1.0M8:compile
[INFO] |  |  |  +- org.apache.ws.commons.schema:XmlSchema:jar:1.4.2:compile
[INFO] |  |  |  +- org.apache.ant:ant:jar:1.7.0:compile
[INFO] |  |  |  +- wsdl4j:wsdl4j:jar:1.6.2:compile
[INFO] |  |  |  +- xerces:xercesImpl:jar:2.8.1:compile
[INFO] |  |  |  +- xerces:xmlParserAPIs:jar:2.6.0:compile
[INFO] |  |  |  \- org.apache.ws.commons.axiom:axiom-api:jar:1.2.7:compile
[INFO] |  |  |     +- org.apache.geronimo.specs:geronimo-activation_1.1_spec:jar:1.0.1:compile
[INFO] |  |  |     +- org.apache.geronimo.specs:geronimo-javamail_1.4_spec:jar:1.2:compile
[INFO] |  |  |     \- jaxen:jaxen:jar:1.1.1:compile
[INFO] |  |  \- xml-apis:xml-apis:jar:1.3.04:compile
[INFO] |  +- com.gxs.e2eui:imqsclient:jar:1.0:compile
[INFO] |  |  \- org.apache.axis2:axis2-jws-api:jar:1.4.1:compile
[INFO] |  |     +- org.apache.ant:ant-launcher:jar:1.7.0:compile
[INFO] |  |     +- org.apache.ws.commons.axiom:axiom-impl:jar:1.2.7:compile
[INFO] |  |     +- org.apache.ws.commons.axiom:axiom-dom:jar:1.2.7:compile
[INFO] |  |     +- javax.mail:mail:jar:1.4.2:compile
[INFO] |  |     |  \- javax.activation:activation:jar:1.1:compile
[INFO] |  |     +- xalan:xalan:jar:2.7.0:compile
[INFO] |  |     +- org.codehaus.woodstox:wstx-asl:jar:3.2.4:compile
[INFO] |  |     \- org.apache.geronimo.specs:geronimo-stax-api_1.0_spec:jar:1.0.1:compile
[INFO] |  +- com.gxs:reportservice-client:jar:05.09.00.16:compile
[INFO] |  +- org.springframework.data:spring-data-commons-core:jar:1.4.1.RELEASE:compile
[INFO] |  +- org.springframework.ws:spring-oxm:jar:1.5.10:compile
[INFO] |  |  +- org.springframework.ws:spring-xml:jar:1.5.10:compile
[INFO] |  |  \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] |  +- org.springframework:spring-context:jar:3.1.2.RELEASE:compile
[INFO] |  |  +- org.springframework:spring-aop:jar:3.1.2.RELEASE:compile
[INFO] |  |  +- org.springframework:spring-expression:jar:3.1.2.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-asm:jar:3.1.2.RELEASE:compile
[INFO] |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.3.2:compile
[INFO] |  +- com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.3.2:compile
[INFO] |  +- org.springframework:spring-core:jar:3.1.2.RELEASE:compile
[INFO] |  +- org.apache.httpcomponents:httpclient:jar:4.3.3:compile
[INFO] |  |  +- org.apache.httpcomponents:httpcore:jar:4.3.2:compile
[INFO] |  |  \- commons-codec:commons-codec:jar:1.6:compile
[INFO] |  +- org.apache.commons:commons-lang3:jar:3.3.2:compile
[INFO] |  +- org.slf4j:slf4j-api:jar:1.7.5:compile
[INFO] |  +- org.slf4j:jcl-over-slf4j:jar:1.7.5:runtime
[INFO] |  +- org.slf4j:slf4j-log4j12:jar:1.7.5:runtime
[INFO] |  \- com.thoughtworks.xstream:xstream:jar:1.2.2:compile
[INFO] |     \- xpp3:xpp3_min:jar:1.1.3.4.O:compile
[INFO] +- org.jboss.spec:jboss-javaee-6.0:pom:1.0.0.Final:provided
[INFO] |  +- org.jboss.spec.javax.annotation:jboss-annotations-api_1.1_spec:jar:1.0.0.Final:provided
[INFO] |  +- org.jboss.spec.javax.resource:jboss-connector-api_1.5_spec:jar:1.0.0.Final:provided
[INFO] |  +- org.jboss.spec.javax.ejb:jboss-ejb-api_3.1_spec:jar:1.0.0.Final:provided
[INFO] |  |  \- javax.xml:jaxrpc-api:jar:1.1:provided
[INFO] |  |     \- javax.xml.soap:saaj-api:jar:1.3:provided
[INFO] |  +- org.jboss.spec.javax.el:jboss-el-api_2.2_spec:jar:1.0.0.Final:provided
[INFO] |  +- org.jboss.spec.javax.interceptor:jboss-interceptors-api_1.1_spec:jar:1.0.0.Final:provided
[INFO] |  +- org.jboss.spec.javax.security.jacc:jboss-jacc-api_1.4_spec:jar:1.0.0.Final:provided
[INFO] |  +- org.jboss.spec.javax.enterprise.deploy:jboss-jad-api_1.2_spec:jar:1.0.0.Final:provided
[INFO] |  +- org.jboss.spec.javax.security.auth.message:jboss-jaspi-api_1.0_spec:jar:1.0.0.Final:provided
[INFO] |  +- org.jboss.spec.javax.xml.registry:jboss-jaxr-api_1.0_spec:jar:1.0.0.Final:provided
[INFO] |  +- org.jboss.spec.javax.jms:jboss-jms-api_1.1_spec:jar:1.0.0.Final:provided
[INFO] |  +- org.jboss.spec.javax.servlet.jsp:jboss-jsp-api_2.2_spec:jar:1.0.0.Final:provided
[INFO] |  +- org.jboss.spec.javax.servlet:jboss-servlet-api_3.0_spec:jar:1.0.0.Final:provided
[INFO] |  +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.1_spec:jar:1.0.0.Final:provided
[INFO] |  +- org.jboss.spec.javax.xml.bind:jboss-jaxb-api_2.2_spec:jar:1.0.0.Final:provided
[INFO] |  +- org.jboss.spec.javax.xml.rpc:jboss-jaxrpc-api_1.1_spec:jar:1.0.0.Final:provided
[INFO] |  +- org.jboss.spec.javax.xml.soap:jboss-saaj-api_1.3_spec:jar:1.0.0.Final:provided
[INFO] |  +- org.jboss.spec.javax.xml.ws:jboss-jaxws-api_2.2_spec:jar:1.0.0.Final:provided
[INFO] |  +- javax.enterprise:cdi-api:jar:1.0-SP4:provided
[INFO] |  +- javax.jws:jsr181-api:jar:1.0-MR1:provided
[INFO] |  +- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.0.Final:provided
[INFO] |  +- org.jboss.resteasy:jaxrs-api:jar:2.1.0.GA:provided
[INFO] |  +- stax:stax-api:jar:1.0.1:provided
[INFO] |  \- javax.validation:validation-api:jar:1.0.0.GA:provided
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.3.2:compile
[INFO] +- com.fasterxml.jackson.core:jackson-core:jar:2.3.2:compile
[INFO] +- com.sun.faces:jsf-api:jar:LATEST:compile
[INFO] +- com.sun.faces:jsf-impl:jar:LATEST:compile
[INFO] +- javax.servlet:jstl:jar:1.2:compile
[INFO] +- commons-fileupload:commons-fileupload:jar:1.3.1:compile
[INFO] +- commons-io:commons-io:jar:2.4:compile
[INFO] +- org.primefaces:primefaces:jar:4.0:compile
[INFO] +- org.primefaces.extensions:primefaces-extensions:jar:2.0.0:compile
[INFO] |  \- com.google.code.gson:gson:jar:2.2.4:compile
[INFO] +- org.primefaces.themes:all-themes:jar:LATEST:compile
[INFO] +- javax.inject:javax.inject:jar:1.0-PFD-1:compile
[INFO] +- org.springframework:spring-web:jar:3.1.2.RELEASE:compile
[INFO] |  +- aopalliance:aopalliance:jar:1.0:compile
[INFO] |  \- org.springframework:spring-beans:jar:3.1.2.RELEASE:compile
[INFO] +- commons-lang:commons-lang:jar:2.6:compile
[INFO] +- log4j:log4j:jar:1.2.15:compile
[INFO] +- xstream:xstream:jar:1.1.2:compile
[INFO] +- junit:junit:jar:4.11:compile
[INFO] |  \- org.hamcrest:hamcrest-core:jar:1.3:compile
[INFO] +- org.mockito:mockito-all:jar:1.8.5:test
[INFO] +- org.springframework:spring-test:jar:3.1.2.RELEASE:compile
[INFO] +- org.glassfish.web:el-impl:jar:2.2:compile
[INFO] |  \- javax.el:el-api:jar:2.2:compile
[INFO] +- com.lowagie:itext:jar:2.1.7:compile
[INFO] |  +- bouncycastle:bcmail-jdk14:jar:138:compile
[INFO] |  +- bouncycastle:bcprov-jdk14:jar:138:compile
[INFO] |  \- org.bouncycastle:bctsp-jdk14:jar:1.38:compile
[INFO] |     +- org.bouncycastle:bcprov-jdk14:jar:1.38:compile
[INFO] |     \- org.bouncycastle:bcmail-jdk14:jar:1.38:compile
[INFO] +- com.gxs:primefaces-theme-tgo:jar:01.00.00.01:compile
[INFO] +- com.gxs:crc-client:jar:2.0.11:compile
[INFO] +- com.gxs:crc-system:jar:2.0.11:compile
[INFO] +- com.gxs.tglogging:tglogging:jar:05.09.00.02:compile
[INFO] +- com.gxs.fms:FMSClient:jar:LATEST:compile
[INFO] \- com.opentext:metrics-service-dto:jar:LATEST:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.374 s
[INFO] Finished at: 2014-11-14T11:26:44-05:00
[INFO] Final Memory: 12M/306M
[INFO] ------------------------------------------------------------------------

Maven依赖关系/构建路径的屏幕截图 enter image description here

部署程序集的屏幕截图 enter image description here 感谢。

4 个答案:

答案 0 :(得分:9)

问题是运行时*.jar依赖项已发布到WEB-APP/lib文件夹中。如果两个依赖项具有相同的名称,则无法发布它们。

您的问题很奇怪的是itext(及其bouncycastle依赖项)非常常见。我们公司的几个项目都有它,但我从未见过类似的警告。

Duplicate bouncycastle dependencies

所以这让我想知道问题来自哪里。两个重复的依赖项(bcmailbcprov)实际上并不重复 - 它们具有不同的版本(因此具有不同的JAR名称)。所以问题必须在其他地方。

请检查 Java构建路径(或检查.classpath项目文件)设置和部署程序集设置。您必须手动无意中包含 bcmail 重复。

Deployment assembly settings

另外请确保您的src/main/webapp/WEB-INF/lib/中没有 bcmail-jdk14-1.38.jar

最后可能的怀疑可能是一些非传统的JBoss部署配置,将两个项目合并到一个Web应用程序中。但我并不熟悉JBoss Tools(只是猜测你是根据你的依赖关系使用它)。

答案 1 :(得分:2)

我已经检查了上面的所有答案,但它们对我不起作用。我发现我的Maven项目与常规Java Web项目有不同的目录。我检查了根目录中的文件.classpath并更改了

<attributes>
        <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>

<attributes>
        <attribute name="org.eclipse.jst.component.dependency" value="**WebRoot**/WEB-INF/lib"/>
</attributes>

解决了我的问题

答案 2 :(得分:1)

我遇到了这个问题,因为我有以下配置

           <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.0.0</version>
                <configuration>
                    <outputFileNameMapping>@{artifactId}@.@{extension}@</outputFileNameMapping>
                </configuration>
            </plugin>

当我将@ version @添加到outputFileNameMapping时,它解决了这个错误。

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.0.0</version>
                <configuration>
                    <outputFileNameMapping>@{artifactId}@.@{extension}@.@{version}@</outputFileNameMapping>
                </configuration>
            </plugin>

答案 3 :(得分:0)

如果在工作区中加载同一项目(依赖项目)的另一个副本,也会发生这种情况。项目A依赖于项目B,但是如果您在项目B中添加branchX,则会遇到此问题。