首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Maven不能重新分配依赖关系

Maven不能重新分配依赖关系
EN

Stack Overflow用户
提问于 2017-05-23 09:20:12
回答 2查看 1.7K关注 0票数 1

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

未能对项目利马执行目标-broker:无法解决项目代理的依赖关系:利马-broker: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:jar:2.1.1-OSGi,Mx4j:mx4j-远程: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:commons:jar:1.3-OSGi,commons-httpclient:commons-httpclient:jar:3.1-osgi,dom4j:dom4j:jar:1.6.1-osgi,公域-jxpath:jxpath:jar:1.3-OSGi,com.thoughtworks.xstream:xstream:jar:1.2.2-osgi,xpp3 3:xpp3_min:jar:1.3.4.OSGi,jaxen:jaxen:jar:1.1.1.1-OSGi,net.java.dev.stax-utils:stax-utils:jar:20080702-osgi,net.sf.saxon:saxon:jar:8.9.0.4-OSGi,Net.sf.saxon:saxon:jar:8.9.0.4,net.sf.saxon:saxon: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:在all.repos (http://our.local/artifactory/all)中找不到工件com.sun.xml.messaging.saaj:saaj-impl:jar:1.3-osgi

问题是我们没有在pom.xml中直接引用这些依赖项:

代码语言:javascript
复制
<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>

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

知道我能怎么解决这个问题吗?我能找到这个问题的根源吗?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2017-05-23 09:30:35

无法在com.sun.xml.messaging.saaj:saaj-impl:jar:1.3-osgi ( all.repos ) (http://our.local/artifactory/all)中找到工件

com.sun.xml.messaging.saaj:saaj-impl:jar:1.3-osgi工件是一个sun库,一些在公共远程存储库中不可用(出于合法性考虑),而且它也是一个osgi版本(这也不常见)。

因此,您没有从公共Maven存储库中找到它也就不足为奇了。

com.sun.xml.messaging.saaj:saaj-impl:jar:1.3-osgi依赖在pom中是不可见的,因为它可能是一个传递依赖项,也就是由包含的依赖项拉动的依赖项。

由于您没有显示构建的全部错误消息,所以我们不能确切地说出是哪个依赖项拉出了它。

要解决您的问题,您可以确定哪个依赖项会拉出这个缺失的依赖项,如果不存在,则在跟踪包含此缺失依赖项的依赖项的问题中添加该问题。也许,有一个解决办法,比如添加一个Maven存储库,它可以提供依赖关系。

无论如何,您可以尝试在可靠的源上找到web上的库,下载它并将其安装到您的工件中,并以deploy插件的deploy:deploy-file为目标。

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

票数 2
EN

Stack Overflow用户

发布于 2017-05-23 09:26:22

大多数工件都可以在mvnrepository.com上找到。

代码语言:javascript
复制
<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>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44130713

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档