The project contains another dependency with the same archive name
Asked Answered
P

4

9

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.jar in two locations:

  • 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?

If it helps, I'm using:

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

Results of 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] ------------------------------------------------------------------------

Screenshot of Maven Dependencies/Build Path enter image description here

Screenshot of Deployment Assembly enter image description here Thanks.

Proto answered 27/10, 2014 at 16:46 Comment(8)
Check your dependency tree (mvn dependency:tree or via POM viewer Eclipse) and exclude the incorrect one (bouncycastle:bcmail-jdk14:138).Conspectus
I see the dependency listed when I do a mvn dependency:tree, but not in the POM in Eclipse.Proto
Can you add the result of dependency:tree to the question?Conspectus
Just to confirm, when do you get the error? I have exactly the same dependencies (duplicate Bouncycastle) in few projects and Maven does not complain about it.Conspectus
Nevermind, just noticed on second read that you see it in Markers view.Conspectus
The error (and 2 others like it) are always in my Problems view. They're not stopping me from working, I'm just hoping to learn more about why they're caused (and fix them in the process).Proto
Was about to write answer how to exclude dependencies, when I have realized that it can not come from Maven dependencies (one is 138 and the other 1.38). So I wrote a different answer with information what to check in your project.Conspectus
In the Eclipse pom editor there is a "Dependency Hierarchy" tab. You can use that to determine where the two archives are being pulled in from (which direct dependencies of your project are including them as transitive dependencies)?Stonybroke
C
10

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

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

Duplicate bouncycastle dependencies

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

Please check your Java Build Path (or check .classpath project file) settings and Deployment Assembly settings. You must have unintentionally included bcmail duplicate manually.

Deployment assembly settings

Also make sure you don't have bcmail-jdk14-1.38.jar in your src/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).

Conspectus answered 14/11, 2014 at 17:6 Comment(3)
Thanks for the great info - I found the duplicate dependency in my build path (the screeshot is an expanded view of my Maven Dependencies), but I'm not sure how to remove it. I've deleted the contents of my .m2 folder several times, but the error persists.Proto
It is not duplicate... please be aware that there is a dot in one name inside version number. So this can not cause the issue.Conspectus
Please check the repo folder, there should be 2 jars inside the org -bouncycastle.If that is the case remove the mapping of one of the jar from your pom.xml, this should avoid the 2 jars.Betelgeuse
M
2

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

<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

Mechanic answered 14/7, 2016 at 3:0 Comment(0)
R
1

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.

<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>
Raymer answered 14/4, 2017 at 6:9 Comment(0)
E
0

This also happens if you load up another copy of the same project (the dependency project) in your workspace. Project A is dependent on Project B but if you add in Project B branchX then you'll have this problem.

Enantiomorph answered 12/7, 2020 at 5:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.