Johannes Kienzle
Johannes Kienzle

Reputation: 58

Maven cannot reslove dependency

We have a maven project that cannot resolve a dependency:

[ERROR] Failed to execute goal on project lima-broker-mule: Could not resolve dependencies for project broker:lima-broker-mule:mule:2.0: The following artifacts could not be resolved: com.sun.xml.messaging.saaj:saaj-impl:jar:1.3-osgi, mx4j:mx4j-jmx:jar:2.1.1-osgi, mx4j:mx4j-impl:jar:2.1.1-osgi, mx4j:mx4j-tools:jar:2.1.1-osgi, mx4j:mx4j-remote:jar:2.1.1-osgi, com.yourkit:yjp-controller-api-redist:jar:9.0.8, org.springmodules:spring-modules-cache:jar:0.9, org.apache.geronimo.specs:geronimo-jms_1.1_spec:jar:1.1-osgi, commons-codec:commons-codec:jar:1.3-osgi, commons-httpclient:commons-httpclient:jar:3.1-osgi, dom4j:dom4j:jar:1.6.1-osgi, commons-jxpath:commons-jxpath:jar:1.3-osgi, com.thoughtworks.xstream:xstream:jar:1.2.2-osgi, xpp3:xpp3_min:jar:1.1.3.4.O-osgi, jaxen:jaxen:jar:1.1.1-osgi, net.java.dev.stax-utils:stax-utils:jar:20080702-osgi, net.sf.saxon:saxon-dom:jar:8.9.0.4-osgi, net.sf.saxon:saxon-xqj:jar:8.9.0.4, net.sf.saxon:saxon:jar:8.9.0.4-osgi, javax.activation:activation:jar:1.1-osgi, org.apache.geronimo.specs:geronimo-j2ee-connector_1.5_spec:jar:1.1-osgi: Could not find artifact com.sun.xml.messaging.saaj:saaj-impl:jar:1.3-osgi in all.repos (http://our.local/artifactory/all)

The problem is that we do not directly reference these dependencies in our pom.xml:

<dependencies>

  <!-- Project -->
  <dependency>
      <groupId>de.lineg.lima.broker</groupId>
      <artifactId>lima-broker-service</artifactId>
      <version>${project.version}</version>
      <scope>compile</scope>
  </dependency>

  <dependency>
      <groupId>net.sourceforge.jtds</groupId>
      <artifactId>jtds</artifactId>
      <version>1.2.4</version>
      <scope>compile</scope>
  </dependency>

  <!-- Transports used by the Mule config -->
  <dependency>
      <groupId>org.mule.modules</groupId>
      <artifactId>mule-module-cxf</artifactId>
      <version>3.2.0</version>
      <scope>provided</scope>
  </dependency>
  <dependency>
      <groupId>org.mule.transports</groupId>
      <artifactId>mule-transport-email</artifactId>
      <version>3.2.0</version>
      <scope>provided</scope>
  </dependency>
  <dependency>
      <groupId>org.mule.transports</groupId>
      <artifactId>mule-transport-vm</artifactId>
      <version>3.2.0</version>
      <scope>provided</scope>
  </dependency>
  <dependency>
      <groupId>org.mule.transports</groupId>
      <artifactId>mule-transport-jetty</artifactId>
      <version>3.2.0</version>
      <exclusions>
          <exclusion>
              <groupId>org.mortbay.jetty</groupId>
              <artifactId>servlet-api</artifactId>
          </exclusion>
          <exclusion>
              <groupId>org.apache.tomcat</groupId>
              <artifactId>jsp-api</artifactId>
          </exclusion>
          <exclusion>
              <groupId>org.apache.tomcat</groupId>
              <artifactId>jasper</artifactId>
          </exclusion>
          <exclusion>
              <groupId>org.apache.tomcat</groupId>
              <artifactId>jasper-el</artifactId>
          </exclusion>
      </exclusions>
  </dependency>

  <!-- Unit tests -->
  <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
  </dependency>
  <dependency>
      <groupId>org.mule.tests</groupId>
      <artifactId>mule-tests-functional</artifactId>
      <version>3.2.0</version>
      <scope>test</scope>
  </dependency>
  <dependency>
      <groupId>org.mule.modules</groupId>
      <artifactId>mule-module-client</artifactId>
      <version>3.2.0</version>
      <scope>test</scope>
  </dependency>
  <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-test</artifactId>
      <version>3.0.5.RELEASE</version>
      <scope>test</scope>
  </dependency>
  <dependency>
      <artifactId>ojdbc6</artifactId>
      <groupId>com.oracle</groupId>
      <scope>test</scope>
      <optional>true</optional>
  </dependency>
  <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-all</artifactId>
      <scope>test</scope>
  </dependency>
  <dependency>
      <groupId>org.easytesting</groupId>
      <artifactId>fest-assert</artifactId>
      <scope>test</scope>
  </dependency>
  <dependency>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
      <scope>test</scope>
  </dependency>

  <dependency>
      <groupId>com.h2database</groupId>
      <artifactId>h2</artifactId>
      <version>1.0.20061217</version>
      <scope>test</scope>
      <optional>true</optional>
  </dependency>
</dependencies>

I don't really know how to resolve this. The dependencies are not in the repositories we have in artifactory and I can't find some of them in any repositories online. I do not know how to find out how theses dependencies are referenced and the dependency plugin from maven can not really help me since the build fails before any output of the dependency plugin can appear.

Any idea how I can solve this issue? Is there any way how I can trace the source of this issue?

Upvotes: 1

Views: 2082

Answers (2)

davidxxx
davidxxx

Reputation: 131546

Could not find artifact com.sun.xml.messaging.saaj:saaj-impl:jar:1.3-osgi in all.repos (http://our.local/artifactory/all)

The com.sun.xml.messaging.saaj:saaj-impl:jar:1.3-osgi artifact is a sun library and some are not available in the public remote repositories(for legality concerns) and besides it is a osgi version (that is not common either).
So it is not so surprising that you don't find it from public Maven repositories.

The com.sun.xml.messaging.saaj:saaj-impl:jar:1.3-osgi dependency is not visible in your pom as it is probably a transitive dependency, that is a dependency pulled by a dependency that you include.
As you don't show the whole error message of the build, we cannot say exactly which dependency pulls it.

To solve your problem, you could identify which dependency pulls this missing dependency and look and add if not exist the problem in the issues tracking of the dependency that includes this missing dependency. Maybe, there is a workaround such as adding a Maven repository that could provide the dependency.

Anyway, you may try to find the library on the web on a reliable source, to download it and install it in your artifactory with the deploy:deploy-file goal of the deploy maven plugin.

Look at this for example : https://maven.apache.org/guides/mini/guide-3rd-party-jars-remote.html

Upvotes: 2

Ursache
Ursache

Reputation: 306

Most of the artifacts can be found on mvnrepository.com

<https://mvnrepository.com/artifact/com.sun.xml.messaging.saaj/saaj-impl>
<https://mvnrepository.com/artifact/mx4j/mx4j-tools/2.1.1>
<https://mvnrepository.com/artifact/com.sun.xml.messaging.saaj/saaj-impl/1.3.2>
<https://mvnrepository.com/artifact/commons-jxpath/commons-jxpath/1.3>

Upvotes: 0

Related Questions