Monday, 22 October 2012

The following artifacts could not be resolved: javax.jms:jms:jar:1.1 (How To Solve)

The post is the backport of a workaround I found to a tricky issue I encountered when working with Apache Zookeeper. The original post on StackOverflow is available here.

The typical error message I encountered when compiling with Maven was:

[ERROR]Failed to execute goal on project ...:
Could not resolve dependencies for project ...:war:1.0.0:
The following artifacts could not be resolved: javax.jms:jms:jar:1.1,
com.sun.jdmk:jmxtools:jar:1.2.1, com.sun.jmx:jmxri:jar:1.2.1:
Failure to find javax.jms:jms:jar:1.1 in http://mirrors.ibiblio.org/maven2/
was cached in the local repository, resolution will not be reattempted until
the update interval of maven2-repository.ibiblio.mirror has elapsed or
updates are forced -> [Help 1]

I was not explicitly importing the missing dependencies, but a Zookeeper dependency was.

I modified my Zookeeper dependency as following and it solved the issue:
<dependency>
    <groupId>org.apache.zookeeper</groupId>
    <artifactId>zookeeper</artifactId>
    <version>3.3.2</version>
    <exclusions>
        <exclusion>
            <groupId>com.sun.jmx</groupId>
            <artifactId>jmxri</artifactId>
        </exclusion>
        <exclusion>
            <groupId>com.sun.jdmk</groupId>
            <artifactId>jmxtools</artifactId>
        </exclusion>
        <exclusion>
            <groupId>javax.jms</groupId>
            <artifactId>jms</artifactId>
        </exclusion>
    </exclusions>
</dependency>
More Maven related posts here.

No comments:

Post a Comment