我有一个包含子模块的 Maven 项目:
/pom.xml
/child1/pom.xml
/child2.pom.xml
当我做一个“maven 包”时,它会创建一个/target/foo.jar。好的。
当我执行“maven rpm:rpm”时,我的构建失败了,因为当它构建其中一个孩子时,它说:
[ERROR] Failed to execute goal
org.codehaus.mojo:rpm-maven-plugin:2.1-alpha-3:attached-rpm (default-cli)
on project child1: Source location target/foo.jar does not exist
我不希望子项目执行 rpm。我只希望父级 rpm 其工件。
文档说:
If this goal is run on a project with modules,
it will run the "rpm:rpm" goal on each module, rather than packaging
the modules into a single RPM.
有没有办法解决这个问题?我不能在执行“mvn 包”时创建 rpm,因为它在 mac 上不起作用,这是大多数人在这里开发的:只应在执行“mvn rpm:rpm”时创建 rpm,或者类似的命令。
这是父pom:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<configuration>
<name>analytics-reporting</name>
<group>rpm</group>
<targetVendor>amazon</targetVendor>
<targetOS>Linux</targetOS>
<filemode>644</filemode>
<username>root</username>
<groupname>root</groupname>
<copyright>LGPL</copyright>
<version>${rpm.version}</version>
<release>${rpm.release}</release>
<mappings>
<mapping>
<directory>/opt/inin</directory>
<sources>
<source>
<location>target/analytics-reporting-engine.jar</location>
</source>
</sources>
</mapping>
</mappings>
</configuration>
</plugin>
这是孩子:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<executions>
<execution>
<phase>none</phase>
</execution>
</executions>
</plugin>