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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26592558/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 05:26:29  来源:igfitidea点击:

The project contains another dependency with the same archive name

eclipsedependency-managementm2em2e-wtp

提问by Jeff Levine

I'm seeing the following error (and a couple of others like it) in my markers:

我在我的标记中看到以下错误(以及其他几个类似的错误):

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.

When I do a quick search, I find bcmail-jdk14.1.jarin two locations:

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

  • C:\Users\LevineJ.m2\repository\bouncycastle\bcmail-jdk14\138
  • C:\Users\LevineJ.m2\repository\org\bouncycastle\bcmail-jdk14\1.38
  • C:\Users\LevineJ.m2\repository\bouncycastle\bcmail-jdk14\138
  • C:\Users\LevineJ.m2\repository\org\bouncycastle\bcmail-jdk14\1.38

From what I've read on the topic (various posts/articles), I'm thinking this has to do with the error I'm seeing. Can someone please provide some info regarding: 1. What does this error mean? 2. How would I go about solving it?

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

If it helps, I'm using:

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

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

Results of mvn dependency:tree

结果 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.Hymanson.core:Hymanson-annotations:jar:2.3.2:compile
[INFO] |  +- com.fasterxml.Hymanson.module:Hymanson-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.Hymanson.core:Hymanson-databind:jar:2.3.2:compile
[INFO] +- com.fasterxml.Hymanson.core:Hymanson-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] ------------------------------------------------------------------------

Screenshot of Maven Dependencies/Build Path enter image description here

Maven 依赖项/构建路径的屏幕截图 在此处输入图片说明

Screenshot of Deployment Assembly enter image description hereThanks.

部署程序集的屏幕截图 在此处输入图片说明谢谢。

回答by Pavel Horal

The issue is that runtime *.jardependencies are published into WEB-APP/libfolder. If two dependencies have the same name, they can not be published.

问题是运行时*.jar依赖项被发布到WEB-APP/lib文件夹中。如果两个依赖同名,则不能发布。

The strange thing with your issue is that itext(with its bouncycastledependencies) are pretty common. Several projects in our company have it, but I have never seen a similar warning.

您的问题的奇怪之处在于itext(及其bouncycastle依赖项)非常普遍。我们公司的几个项目都有,但是我从来没有看到过类似的警告。

Duplicate bouncycastle dependencies

重复的 bouncycastle 依赖项

So this makes me wonder, where the issue comes from. The two duplicate dependencies (bcmailand bcprov) are actually not duplicate - they have different version(hence different JAR name). So the issue must be somewhere else.

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

Please check your Java Build Path(or check .classpathproject file) settings and Deployment Assemblysettings. You must have unintentionally included bcmailduplicate manually.

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

Deployment assembly settings

部署程序集设置

Also make sure you don't have bcmail-jdk14-1.38.jarin your src/main/webapp/WEB-INF/lib/.

还要确保您的 .jar 文件中没有bcmail-jdk14-1.38.jarsrc/main/webapp/WEB-INF/lib/

And last possible suspect might be some unconventional JBoss deployment configuration combining two projects into one web application. But I am not that familiar with JBoss Tools (just guessing you are using it based on your dependencies).

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

回答by PineCone

I've checked all answers above but they don't work for me. I found that my Maven project has a different directory than regular Java Web project. I checked file .classpath in root directory and I changed

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

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

to

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

which solved my problem

这解决了我的问题

回答by Bhushan

I was getting this issue because I was having following configuration

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

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

When I added @version@ to outputFileNameMapping, it resolved this error.

当我将 @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>