【发布时间】:2014-06-03 10:38:44
【问题描述】:
我有一个包含子模块的 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 package”时创建 rpm,因为它在 mac 上不起作用,这是大多数人在这里开发的:rpm 只能在执行“mvn 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>
【问题讨论】:
-
查看这个答案:stackoverflow.com/a/14210506/1089062。把它放在你的孩子 poms 里。
-
感谢您的信息,但它不起作用。对我来说,它应该工作是完全有道理的,但它没有,我不明白为什么。我将使用父 pom 和子 pom 更新我的原始问题。