常春藤2.3无法解决jersey-servlet 1.13(或1.11或1.12)的依赖关系 [英] ivy 2.3 can't resolve dependencies for jersey-servlet 1.13 (or 1.11, or 1.12)

查看:135
本文介绍了常春藤2.3无法解决jersey-servlet 1.13(或1.11或1.12)的依赖关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用ivy将jersey-servlet包含在我的项目中.我的依赖关系如下所示:

I am trying to include jersey-servlet in my project using ivy. My dependency looks like this:

<dependency org="com.sun.jersey"    name="jersey-servlet"   rev="${jersey.version}"/>

...但是我遇到了一些未解决的依赖项:

...but I am running into some unresolved dependencies:

[ivy:resolve]       ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:resolve]       ::          UNRESOLVED DEPENDENCIES         ::
[ivy:resolve]       ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:resolve]       :: org.eclipse.persistence#org.eclipse.persistence.moxy;2.3.2: not found
[ivy:resolve]       :: org.jboss.spec.javax.interceptor#jboss-interceptors-api_1.1_spec;${interceptor.api.version}: not found
[ivy:resolve]       :: javax.inject#javax.inject;${atinject.api.version}: not found
[ivy:resolve]       :: org.jboss.weld#weld-api;1.1.4.Final: not found
[ivy:resolve]       :: org.jboss.weld#weld-spi;1.1.4.Final: not found
[ivy:resolve]       ::::::::::::::::::::::::::::::::::::::::::::::

我的研究告诉我weld-spi/api 1.1.4.Final 不存在.看起来这些是weld-osgi-bundle-1.1.4.Final.jar的依赖项.但是,如果您打开该jar并在META-INF目录中四处挖掘,则存在对weld-spi/api 1.1.Final 的引用.

My research tells me weld-spi/api 1.1.4.Final do not exist. It looks like these are dependencies of weld-osgi-bundle-1.1.4.Final.jar. But if you open that jar and dig around inside the META-INF directory, there are references to weld-spi/api 1.1.Final, which DO exist.

此外,在Maven存储库中,weld-osgi-bundle 1.1.4的依赖关系表最终在``版本''列中未显示任何内容.

Plus, in the maven repository, the dependencies table for weld-osgi-bundle 1.1.4.Final shows nothing in the version column.

是否可能是常春藤为其所有依赖项默认使用1.1.4.weld-osgi-bundle的最终版本,而maven知道在哪里可以找到正确的依赖项版本?

Could it be that ivy is defaulting to the 1.1.4.Final version of the weld-osgi-bundle for all of its dependencies, whereas maven knows where to find the correct versions of the dependencies?

常春藤有办法解决这个问题吗?

Is there a way around this with ivy?

==>根据Eyads的评论更新可正常使用的ivy.xml:

ivy.xml具有以下依赖性:

ivy.xml has the following dependencies:

<dependency org="com.sun.jersey" name="jersey-servlet" rev="${jersey.version}" transitive="false"/>
<dependency org="org.jboss.weld" name="weld-api" rev="1.1.Final" force="true"/>

注意,我还需要添加eclipselink存储库以克服moxy依赖项:

Note, I also needed to add the eclipselink repo to get past the moxy dependency:

<ibiblio
name="eclipselink"
m2compatible="true"
root="http://download.eclipse.org/rt/eclipselink/maven.repo"
/>

推荐答案

尝试在您需要的版本中使用依赖项标记中的'force = true'来包含该依赖项. 我不确定我是否完全正确,但是在ivy.xml文件中未显式声明最后一个依赖项,因此您可以显式添加它,并为其添加一个,即:

try to include that dependency with the version you want with 'force=true' in the dependency tag. I'm not sure if I got it completely right but this last dependency is not explicitly declared in your ivy.xml file, therefore you could add it explicitly and for the one that that you have, namely:

<dependency org="com.sun.jersey"    name="jersey-servlet"   rev="${jersey.version}" transitive="false" />

请注意依赖项标记中的可传递属性.

Notice the transitive attribute in the dependency tag.

这将阻止它带来所需的依赖关系(显然是weld-api).

This will prevent it from bringing the dependency that it wants (apparently the weld-api).

==============

==============

我们公司现在遇到相同的问题,但原因有所不同. 我们正试图包含另一个依赖项

We have now the same problem in my company but for a different reason. we were trying to include another dependency

<dependency org="org.jboss.weld.se" name="weld-se-core" rev="1.1.8.Final" />

这将尝试检索修订版本为1.1.8.Final的weld-api和weld-spi.我们看到的原因是,在maven pom中,他们对父项依赖项有一个"import"标签,该标签依赖于另一个父项pom(简而言之).

This will try to retrieve weld-api and weld-spi with revision of 1.1.8.Final. The reason we came to see, was that in maven pom they have an "import" tag for their parent dependency which depends on another parent pom (in a nutshell).

所以Ivy不知道如何处理它,它使用的是当前版本1.1.8.Final,而不是为api和spi声明1.1.Final的版本.

So Ivy doesn't know how to deal with it and it uses the current version 1.1.8.Final instead of the one that declares 1.1.Final for the api and spi.

您要么解决IVY,然后从缓存中删除一个文件夹org.jboss.weld.se,但是将org.jboss.weld保留在其中,然后再次解决.

You either resolve IVY and delete one the folder org.jboss.weld.se from cache but keep org.jboss.weld in it, and then resolve again.

或者您可以添加这些内容:

Or you could add those:

<dependency org="org.jboss.weld" name="weld-spi" rev="1.1.Final" force="true"/>
<dependency org="org.jboss.weld" name="weld-api" rev="1.1.Final" force="true"/>

在原始依赖项之上.

如果将它放在后面,它将仍然无法覆盖该版本.

If you put it afterwards it will still fail to override the version.

这篇关于常春藤2.3无法解决jersey-servlet 1.13(或1.11或1.12)的依赖关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆