Maven 3:叠加不是项目的依赖

Sér*_*els 6 java war maven-3 maven

我正在尝试测试maven-war-plugin的叠加功能.基本上我需要合并两个战争项目.

所以我将战争定义为依赖:

<dependency> 
  <groupId>my.group.id</groupId> 
  <artifactId>my-legacy-war-project</artifactId> 
  <version>${project.version}</version> 
  <type>war</type> 
</dependency>
Run Code Online (Sandbox Code Playgroud)

然后配置叠加层:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-war-plugin</artifactId>
  <configuration>
    <overlays>
      <overlay>
        <groupId>my.group.id</groupId>
        <artifactId>my-legacy-war-project</artifactId>
        <targetPath>legacy</targetPath>
      </overlay>
    </overlays>
  </configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)

但Maven无法构建这个项目,抱怨这种依赖:

[错误]无法执行目标org.apache.maven.plugins:maven-war-plugin:2.3:项目my-project上的爆炸(默认):overlay [id my.group.id:my-legacy-war-project]不是项目的依赖项. - > [帮助1]

叠加层应该与Maven 3.0.5一起使用?为什么构建抱怨声明的依赖?

Sér*_*els 11

不知道为什么,但使用id的替代groupIdartifactId在覆盖工作:

  <configuration>
    <overlays>
      <overlay>
        <id>my-legacy-war-project</id>
        <targetPath>legacy</targetPath>
      </overlay>
    </overlays>
  </configuration>
Run Code Online (Sandbox Code Playgroud)