Maven POM依赖和汇编

时间:2015-11-10 12:58:41

标签: maven

pom.xmltype=pom有依赖关系。在这个依赖项中,我有一组依赖type=jar

现在我需要将一些JAR添加到程序集中 (包括使用dependencySet构建它们 - >包括)。

如果我设置了"include"组和POM依赖关系的工件,我会在构建中得到pom.xml作为结果。

如果我进入'"包括"来自外部pom的依赖关系的组和工件,我得到一个构建错误:

  

未正确配置程序集:一个或多个筛选器具有不匹配的条件。

有没有人见过这个问题?

这是我的主要POM:

    <dependency>
        <groupId>slf4j</groupId>
        <artifactId>slf4j</artifactId>
        <type>pom</type>
    </dependency>

这是我的外部POM:

<dependencies>
<dependency>
  <groupId>slf4j</groupId>
  <artifactId>slf4j-api</artifactId>
  <version>1.7.0</version>
  <type>jar</type>
</dependency>
<dependency>
  <groupId>slf4j</groupId>
  <artifactId>slf4j-log4j12</artifactId>
  <version>1.7.0</version>
  <type>jar</type>
</dependency>

这是我的assembly.xml:

<dependencySets>
    <dependencySet>
        <outputDirectory>output dir</outputDirectory>
        <includes>

            <include>apache:commons-configuration</include>
            <include>apache:commons-logging</include>
            <include>apache:commons-lang</include>
            <include>org.perf4j:perf4j</include>

            **Here I want to add slf4j-api and slf4j-log4j12 from external pom**
        </includes>
        <outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping>
        <useStrictFiltering>true</useStrictFiltering>
        <useTransitiveDependencies>false</useTransitiveDependencies>
        <useProjectArtifact>false</useProjectArtifact>
        <scope>runtime</scope>
    </dependencySet>

这是主要的pom:

    <dependency>
        <groupId>slf4j</groupId>
        <artifactId>slf4j</artifactId>
        <type>pom</type>
    </dependency>

这是外部的pom:

<dependencies>
<dependency>
  <groupId>slf4j</groupId>
  <artifactId>slf4j-api</artifactId>
  <version>1.7.0</version>
  <type>jar</type>
</dependency>
<dependency>
  <groupId>slf4j</groupId>
  <artifactId>slf4j-log4j12</artifactId>
  <version>1.7.0</version>
  <type>jar</type>
</dependency>

这是assembly.xml:

<dependencySets>
    <dependencySet>
        <outputDirectory>output dir</outputDirectory>
        <includes>

            <include>apache:commons-configuration</include>
            <include>apache:commons-logging</include>
            <include>apache:commons-lang</include>
            <include>org.perf4j:perf4j</include>

            **Here I want to add slf4j-api and slf4j-log4j12 from external pom**
        </includes>
        <outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping>
        <useStrictFiltering>true</useStrictFiltering>
        <useTransitiveDependencies>false</useTransitiveDependencies>
        <useProjectArtifact>false</useProjectArtifact>
        <scope>runtime</scope>
    </dependencySet>

1 个答案:

答案 0 :(得分:0)

useTransitiveDependencies应设置为“true”,而不是dependencySet中的“false”。