Maven无法重新依赖依赖

时间:2017-05-23 09:20:13

标签: java maven dependencies

我们有一个无法解决依赖关系的maven项目:

  

[错误]无法在项目lima-broker-mule上执行目标:无法执行   解决项目的依赖关系   经纪人:lima-broker-mule:mule:2.0:以下   工件无法解决:   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控制器-API-REDIST:罐:9.0.8,   org.springmodules:弹簧模块高速缓冲存储器中:jar:0.9,   org.apache.geronimo.specs:Geronimo的jms_1.1_spec中:jar:1.1-OSGi中,   公地编解码器:公地编解码器中:jar:1.3-OSGi中,   公地的HttpClient:公地的HttpClient:罐子:3.1 OSGi的,   DOM4J:DOM4J:罐子:1.6.1-OSGi中,   公地的JXPath:公地的JXPath中:jar:1.3-OSGi中,   com.thoughtworks.xstream:XStream的:坛子: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的:坛子:20080702-OSGi中,   net.sf.saxon:撒克逊-DOM中:jar:8.9.0.4 OSGi的,   net.sf.saxon:撒克逊XQJ:罐子:8.9.0.4,   net.sf.saxon:撒克逊:罐子:8.9.0.4 OSGi的,   javax.activation中:激活:罐:1.1-OSGi中,   org.apache.geronimo.specs:Geronimo的J2EE-connector_1.5_spec中:jar:1.1-OSGi的:   找不到神器   com.sun.xml.messaging.saaj:saaj-impl:jar:all -repos中的1.3-osgi   (http://our.local/artifactory/all

问题是我们不直接在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>

我真的不知道如何解决这个问题。依赖关系不在我们在artifactory中的存储库中,我无法在任何存储库中找到它们中的一些。我不知道如何找出如何引用这些依赖项,并且maven的依赖插件无法真正帮助我,因为在依赖插件的任何输出出现之前构建都会失败。

知道如何解决这个问题吗?有什么方法可以追溯这个问题的根源吗?

2 个答案:

答案 0 :(得分:2)

  

无法找到神器   com.sun.xml.messaging.saaj:saaj-impl:jar:all -repos中的1.3-osgi   (http://our.local/artifactory/all

com.sun.xml.messaging.saaj:saaj-impl:jar:1.3-osgi工件是一个太阳库,有些在公共远程存储库中不可用(为了合法性问题),而且它是一个osgi版本(也不常见)。
因此,从公共Maven资源库中找不到它也就不足为奇了。

{p 1}}依赖项在您的pom中不可见,因为它可能是一个传递依赖项,即由您包含的依赖项所引入的依赖项。
由于您没有显示构建的整个错误消息,我们无法确切地说出哪个依赖项会将其拉出来。

要解决您的问题,您可以确定哪个依赖项会提取此缺失的依赖项,并查看并添加(如果不存在)问题跟踪包含此缺少的依赖项的依赖项中的问题。也许,有一种解决方法,例如添加可以提供依赖性的Maven存储库。

无论如何,您可以尝试在可靠来源的网站上找到该库,下载并使用deploy maven插件的com.sun.xml.messaging.saaj:saaj-impl:jar:1.3-osgi目标将其安装到您的工件中。

看看这个例子: https://maven.apache.org/guides/mini/guide-3rd-party-jars-remote.html

答案 1 :(得分:0)

大多数工件都可以在 mvnrepository.com

上找到
$("#yourdropdownid option:selected").text();