如何在子模块上禁用rpm maven插件

如何在子模块上禁用rpm maven插件,maven,rpm-maven-plugin,Maven,Rpm Maven Plugin,我有一个maven项目,它有子模块: /pom.xml /child1/pom.xml /child2.pom.xml 当我执行maven包时,它会创建一个/target/foo.jar。好 当我使用maven rpm:rpm时,我的构建会失败,因为当我构建一个child时,它会说: [ERROR] Failed to execute goal org.codehaus.mojo:rpm-maven-plugin:2.1-alpha-3:attached-rpm (default-cli)

我有一个maven项目,它有子模块:

/pom.xml
/child1/pom.xml
/child2.pom.xml
当我执行maven包时,它会创建一个/target/foo.jar。好

当我使用maven rpm:rpm时,我的构建会失败,因为当我构建一个child时,它会说:

[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

报告说:

有没有办法绕过这个问题? 我不能在执行mvn包时创建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>

在插件的执行中,您需要指定不继承插件,如下所示:

<executions>
  <execution>
    <inherited>false</inherited>
    <id>attach-rpm</id>
    <goals>
      <goal>attached-rpm</goal>
    </goals>
  </execution>
</executions>

请参阅以下答案:。把它放在你的孩子poms里。谢谢你的信息,但它不起作用。这对我来说很有意义,它应该能工作,但它没有,我不明白为什么。我将用父pom和子pom更新我的原始问题。
<executions>
  <execution>
    <inherited>false</inherited>
    <id>attach-rpm</id>
    <goals>
      <goal>attached-rpm</goal>
    </goals>
  </execution>
</executions>