org.eclipse.core对org.eclipse.runtime的依赖突然改变了

时间:2013-08-21 07:04:35

标签: eclipse maven maven-2 osgi osgi-bundle

我们用maven编译一个Adobe CQ项目(服务,标签,视图,内容等)。在某个时间点,我们引入了以下依赖项:

        <dependency>
            <groupId>org.eclipse.core</groupId>
            <artifactId>resources</artifactId>
            <version>3.3.0-v20070604</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.equinox</groupId>
            <artifactId>registry</artifactId>
            <version>3.3.0-v20070522</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.core</groupId>
            <artifactId>jobs</artifactId>
            <version>3.3.0-v20070423</version>
        </dependency>

这导致以下依赖关系,例如for org.eclipse.resources(使用mvn依赖项提取:tree -Dverbose):

[INFO] +- org.eclipse.core:resources:jar:3.3.0-v20070604:compile
[INFO] |  +- org.eclipse.core:expressions:jar:3.3.0-v20070606-0010:compile
[INFO] |  |  \- (org.eclipse.core:runtime:jar:3.3.100-v20070530:compile - omitted for duplicate)
[INFO] |  +- org.eclipse.core:filesystem:jar:1.1.0-v20070606:compile
[INFO] |  |  +- (org.eclipse.equinox:common:jar:3.3.0-v20070426:compile - omitted for duplicate)
[INFO] |  |  +- (org.eclipse.equinox:registry:jar:3.3.0-v20070522:compile - omitted for duplicate)
[INFO] |  |  \- (org.eclipse:osgi:jar:3.3.0-v20070530:compile - omitted for duplicate)
[INFO] |  \- org.eclipse.core:runtime:jar:3.3.100-v20070530:compile
[INFO] |     +- (org.eclipse:osgi:jar:3.8.2.v20130124-134944:compile - omitted for duplicate)
[INFO] |     +- (org.eclipse.equinox:common:jar:3.3.0-v20070426:compile - omitted for duplicate)
[INFO] |     +- (org.eclipse.core:jobs:jar:3.3.0-v20070423:compile - omitted for duplicate)
[INFO] |     +- (org.eclipse.equinox:registry:jar:3.3.1:compile - omitted for duplicate)
[INFO] |     +- org.eclipse.equinox:preferences:jar:3.2.100-v20070522:compile
[INFO] |     |  \- (org.eclipse.equinox:common:jar:3.3.0-v20070426:compile - omitted for duplicate)
[INFO] |     +- org.eclipse.core:contenttype:jar:3.2.100-v20070319:compile
[INFO] |     |  +- (org.eclipse.equinox:preferences:jar:3.2.100-v20070522:compile - omitted for duplicate)
[INFO] |     |  +- (org.eclipse.equinox:registry:jar:3.3.1:compile - omitted for duplicate)
[INFO] |     |  \- (org.eclipse.equinox:common:jar:3.3.0-v20070426:compile - omitted for duplicate)
[INFO] |     \- org.eclipse.equinox:app:jar:1.0.0-v20070606:compile
[INFO] |        +- (org.eclipse.equinox:registry:jar:3.3.1:compile - omitted for duplicate)
[INFO] |        \- (org.eclipse.equinox:common:jar:3.3.0-v20070426:compile - omitted for duplicate)

然后,从2013年8月19日星期一到8月20日,org.eclipse:osgi依赖从突然变为3.3.0-something到3.8.2-something,没有任何明显的原因(这打破了我们的构建) :

[INFO] +- org.eclipse.core:resources:jar:3.3.0-v20070604:compile
[INFO] |  +- org.eclipse.core:expressions:jar:3.3.0-v20070606-0010:compile
[INFO] |  |  \- (org.eclipse.core:runtime:jar:3.3.100-v20070530:compile - omitted for duplicate)
[INFO] |  +- org.eclipse.core:filesystem:jar:1.1.0-v20070606:compile
[INFO] |  |  +- (org.eclipse.equinox:common:jar:3.3.0-v20070426:compile - omitted for duplicate)
[INFO] |  |  +- (org.eclipse.equinox:registry:jar:3.3.0-v20070522:compile - omitted for duplicate)
[INFO] |  |  \- org.eclipse:osgi:jar:3.8.2.v20130124-134944:compile
[INFO] |  \- org.eclipse.core:runtime:jar:3.3.100-v20070530:compile
[INFO] |     +- (org.eclipse:osgi:jar:3.8.2.v20130124-134944:compile - omitted for duplicate)
[INFO] |     +- (org.eclipse.equinox:common:jar:3.3.0-v20070426:compile - omitted for duplicate)
[INFO] |     +- (org.eclipse.core:jobs:jar:3.3.0-v20070423:compile - omitted for duplicate)
[INFO] |     +- (org.eclipse.equinox:registry:jar:3.3.1:compile - omitted for duplicate)
[INFO] |     +- org.eclipse.equinox:preferences:jar:3.2.100-v20070522:compile
[INFO] |     |  \- (org.eclipse.equinox:common:jar:3.3.0-v20070426:compile - omitted for duplicate)
[INFO] |     +- org.eclipse.core:contenttype:jar:3.2.100-v20070319:compile
[INFO] |     |  +- (org.eclipse.equinox:preferences:jar:3.2.100-v20070522:compile - omitted for duplicate)
[INFO] |     |  +- (org.eclipse.equinox:registry:jar:3.3.1:compile - omitted for duplicate)
[INFO] |     |  \- (org.eclipse.equinox:common:jar:3.3.0-v20070426:compile - omitted for duplicate)
[INFO] |     \- org.eclipse.equinox:app:jar:1.0.0-v20070606:compile
[INFO] |        +- (org.eclipse.equinox:registry:jar:3.3.1:compile - omitted for duplicate)
[INFO] |        \- (org.eclipse.equinox:common:jar:3.3.0-v20070426:compile - omitted for duplicate)

我们能够通过明确地添加依赖关系来解决这个问题:

    <dependency>
        <groupId>org.eclipse</groupId>
        <artifactId>osgi</artifactId>
        <version>3.3.0-v20070530</version>
    </dependency>

但是,我们仍然没有任何线索,为什么依赖性发生了变化。有人知道原因或遇到同样的问题吗?

2 个答案:

答案 0 :(得分:1)

在深入研究pom文件,.m2 / repository / repository.xml和几个maven-metadata.xml文件之后,我找到了根本原因。

maven-metadata.xml file in Maven repository http://repo.adobe.com for org.eclipse.osgi似乎已于8月20日发生变化。由于某种原因,此文件的日期现在重置为7月11日,但更改仍然是:

元数据文件已从

更改
<metadata>
<groupId>org.eclipse</groupId>
<artifactId>osgi</artifactId>
<version>3.3.0-v20070530</version>
<versioning>
<versions>
...
</versions>
<lastUpdated>20071127073207</lastUpdated>
</versioning>
</metadata>

<metadata modelVersion="1.1.0">
<groupId>org.eclipse</groupId>
<artifactId>osgi</artifactId>
<version>3.3.0-v20070530</version>
<versioning>
<latest>3.8.2.v20130124-134944</latest>
<release>3.8.2.v20130124-134944</release>
<versions>
...
</versions>
<lastUpdated>20130711152942</lastUpdated>
</versioning>
</metadata>

显然,最新版本是在更改后提供的,现在已经是3.8.2而不是3.3.0。

答案 1 :(得分:0)

问题可能是由版本范围引起的。这些范围甚至不必用于Eclipse工件。

假设您依赖于[1,2]和1.1,并且1.2可用。在某个时刻,添加了具有不同依赖关系的1.3。如果它找到多个具有不同版本的groupId:artifactId,那么它会选择它找到的第一个。 Maven遵循广泛的第一个策略来查找依赖关系,以便您可以在顶级pom中覆盖它。这当然是非常模糊和容易出错的。更好的方法是在一个pom中指定所有应用程序依赖项,以便确保有效版本。