Maven POM依赖性和组装

  • 本文关键字:依赖性 POM Maven maven
  • 更新时间 :
  • 英文 :


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

现在我需要将其中一些JAR添加到汇编中(包含它们以使用dependencySet->includes进行构建)。

如果我设置为"include"组和POM依赖的工件,那么我在构建中会得到POM.xml。

如果我从外部pom设置为"include"组和依赖项的工件,我会得到一个构建错误:

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

有人看到这个问题了吗?

这是我的主要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>

useTransitiveDependencies在我的dependencySet中应该设置为"true"而不是"false"。

最新更新