I have a maven project that has submodules:
/pom.xml
/child1/pom.xml
/child2.pom.xml
When I do a "maven package", it creates a /target/foo.jar. Good.
When I do a "maven rpm:rpm", my build fails because when it goes to build one of the childs, it says:
[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
I don't want the child projects to do an rpm. I only want the parent to rpm its artifact.
The documentation says:
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.
Is there a way to get around this? I cannot have the rpm be created when doing a "mvn package", since it does not work on a mac, which is what most people develop on here: the rpm should only be created when doing a "mvn rpm:rpm", or similar command.
Here is the parent 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>
Here is the child:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<executions>
<execution>
<phase>none</phase>
</execution>
</executions>
</plugin>
There is a property for that. https://www.mojohaus.org/rpm-maven-plugin/rpm-mojo.html#disabled
<rpm.disabled>true</rpm.disabled>