Maven 第谷:';无法满足依赖性…';通过多模块父级进行构建时

Maven 第谷:';无法满足依赖性…';通过多模块父级进行构建时,maven,tycho,Maven,Tycho,我必须用Maven/Tycho构建一个Eclipse插件,它依赖于其他第三方。由于Tycho还不支持嵌入依赖项,我将项目分为两部分,如下所示: ./pom.xml ./first-thirdparty pom.xml ./first src/main/java/org/mydemo/Test.java // has just one method that simply returns AxisFault.class.getSimpleName(); to test import

我必须用Maven/Tycho构建一个Eclipse插件,它依赖于其他第三方。由于Tycho还不支持嵌入依赖项,我将项目分为两部分,如下所示:

./pom.xml
./first-thirdparty
    pom.xml
./first
    src/main/java/org/mydemo/Test.java // has just one method that simply returns AxisFault.class.getSimpleName(); to test import resolution
    META-INF/MANIFEST.MF
    build.properties
    pom.xml
  • A-thirdparty
    :带有打包“bundle”的项目,由maven bundle plugin构建,具有'Embed-Dependency'指令,并导出插件所需的所有包'A'
  • A
    :使用tycho maven插件和tycho的目标平台配置插件(将
    pomDependencies
    设置为
    考虑
    )打包“eclipse插件”的项目
当我分别构建它们时(首先是第三方聚合器,然后是项目A本身),一切正常。但是,如果我聚合这两个项目(使用多模块POM),我会得到以下Maven错误:

Caused by: java.lang.RuntimeException: "No solution found because the problem is unsatisfiable.": ["Unable to satisfy dependency from A 1.0.0.qualifier to package org.apache.axis2.transaction 0.0.0.", "Unable to satisfy dependency from A 1.0.0.qualifier to package org.apache.axis2.addressing.i18n 0.0.0.", ...
为什么以聚合方式构建项目会导致此错误,如果这是Tycho bug,那么可以采取何种解决方法

不过,如果我只在聚合POM中留下一个模块(独立于哪个模块),则不会出现错误

编辑

无法使用小型、类似的多模块样本进行复制。这意味着我的POM等级有点问题

EDIT2

在包含了相同的依赖项集(两个axis2和axiom LIB)之后,能够用一个小的、类似的多模块样本重现

EDIT3:简约主义示例

现在我想知道问题是否在于缺少我所包含的第三方库所需的所有第三方。如果是这样的话,那么为什么我能够在分别执行两个模块时成功构建,而构建只有在通过父级multi-module pom.xml完成时才会失败?下面的示例仅包括一个axis2内核JAR,捆绑在名为first thirdparty的pom first工件中

示例中没有使用
A
,而是使用keywoard
first
。文件夹结构如下所示:

./pom.xml
./first-thirdparty
    pom.xml
./first
    src/main/java/org/mydemo/Test.java // has just one method that simply returns AxisFault.class.getSimpleName(); to test import resolution
    META-INF/MANIFEST.MF
    build.properties
    pom.xml
根聚甲醛:

<project xmlns="http://maven.apache.org/POM/4.0.0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
        http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.mydemo</groupId>
    <artifactId>first-aggregator</artifactId>

    <packaging>pom</packaging>
    <version>1.0.0-SNAPSHOT</version>


    <modules>
        <module>first-thirdparty</module>
        <module>first</module>
    </modules>

</project>
first
的POM,它是一个eclipse插件,依赖于
first thirdparty

<project xmlns="http://maven.apache.org/POM/4.0.0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
        http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.mydemo</groupId>
        <artifactId>first-aggregator</artifactId>
        <version>1.0.0-SNAPSHOT</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <groupId>org.mydemo</groupId>
    <artifactId>org.mydemo.first-bundle</artifactId>

    <packaging>eclipse-plugin</packaging>
    <version>1.0.0-SNAPSHOT</version>

    <properties>
        <tycho.ver>0.14.1</tycho.ver>
    </properties>

    <repositories>
        <repository>
            <id>helios</id>
            <layout>p2</layout>
            <url>http://download.eclipse.org/releases/indigo</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.mydemo</groupId>
            <artifactId>first-thirdparty</artifactId>
            <version>1.0.0-SNAPSHOT</version>
        </dependency>
    </dependencies>

    <build> 
        <plugins>
            <plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>tycho-maven-plugin</artifactId>
                <version>${tycho.ver}</version>
                <extensions>true</extensions>
            </plugin>
            <plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>target-platform-configuration</artifactId>
                <version>${tycho.ver}</version>
                <configuration>
                    <pomDependencies>consider</pomDependencies>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

不可能在同一反应器中构建“POM优先”捆绑包(即使用maven捆绑包插件构建的捆绑包)和“清单优先”捆绑包(即Tycho构建的捆绑包)。这是一个很好的例子


原因是Tycho在Maven生命周期中过早地进行依赖项解析,而Maven捆绑包插件还没有机会生成清单(Tycho需要)。解决这个问题需要时间,但我仍然希望在中期内完成。

我也遇到了同样的问题。我希望通过这种方式解决我的问题,希望能对您有所帮助

1出现错误的原因是缺少插件JAR。比如你的情况 “原因:java.lang.RuntimeException:“找不到解决方案,因为问题无法解决。”:[“无法满足从1.0.0.qualifier到包org.apache.axis2.transaction 0.0.0的依赖关系。”,” 看看第一个,在maven存储库中没有“org.apache.axis2.transaction 0.0.0.”。老实说,我不确定jar用于什么以及如何获得它,我只是缺少其他版本eclipse的一些插件依赖性,所以我只需要在/eclipse/plugins中使用jar 所以你要做的就是自己创建一个p2存储库

2将此存储库放入您的maven pom文件中

    <repository>
        <id>localP2resp</id>
        <url>file:///F:/P2Repository</url>
        <layout>p2</layout>
    </repository>

本地p2resp
file:///F:/P2Repository
p2
3到目前为止,如果您的存储库中有您需要的插件jar,那么您应该解决这个问题


如果您还有其他问题或者对我的答案不太满意,请继续询问thx

,这将有助于向我们展示您的master pom.xml以及您调用Maven的命令。@SpellingD Ok,我将提供代码示例,因为我已尽量减少了代码。@SpellingD没有那么多代码,但我正在考虑将其转移到一些共享中存储。如果您可以建议,请这样做。我现在想知道,关于Axis2依赖项的问题是否不包括在内,这是否会影响构建过程。但是,我可以单独构建这些模块,所以我想知道通过多模块父级聚合它们有什么问题。谢谢,这是一个非常有价值的评论。我会确保不会o尽快打开请求,因为我们有兴趣在单个版本中运行此案例。我接受您的回答,因为它清楚地解释了我问题的原因。
    <repository>
        <id>localP2resp</id>
        <url>file:///F:/P2Repository</url>
        <layout>p2</layout>
    </repository>