gpt4 book ai didi

java - Maven 3 : Overlay is not a dependency of the project

转载 作者:行者123 更新时间:2023-12-01 18:04:53 25 4
gpt4 key购买 nike

我正在尝试测试 maven-war-plugin 的覆盖功能。基本上我需要合并两个 war 项目。

所以我将 war 定义为依赖:

<dependency> 
<groupId>my.group.id</groupId>
<artifactId>my-legacy-war-project</artifactId>
<version>${project.version}</version>
<type>war</type>
</dependency>

然后配置覆盖:

<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>

但是 Maven 无法构建这个项目,并提示这种依赖关系:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.3:exploded (default) on project my-project: overlay [ id my.group.id:my-legacy-war-project] is not a dependency of the project. -> [Help 1]

覆盖层应该与 Maven 3.0.5 一起使用吗?为什么构建会提示声明的依赖项?

最佳答案

不知道为什么,但在叠加层中使用 id 而不是 groupIdartifactId 有效:

  <configuration>
<overlays>
<overlay>
<id>my-legacy-war-project</id>
<targetPath>legacy</targetPath>
</overlay>
</overlays>
</configuration>

关于java - Maven 3 : Overlay is not a dependency of the project,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22014671/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com