When running
mvn clean rpm:rpm
I get this error : The parameters 'group' for goal org.codehaus.mojo:rpm-maven-plugin:2.1.5:rpm are missing or invalid
My parent pom.xml :
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>net.brewspberry</groupId>
<artifactId>brewspberry-rpm-parent</artifactId>
<version>0.1.0-SNAPSHOT</version>
<name>brewspberry-rpm-parent</name>
<description>brewspberry-rpm-parent</description>
<packaging>pom</packaging>
<properties>
<rpm.install.basedir>/opt/tomcat</rpm.install.basedir>
<rpm.install.webapps>${rpm.install.basedir}/webapps</rpm.install.webapps>
<rpm.install.config>${rpm.install.basedir}/lib</rpm.install.config>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.group>Internet</project.build.group>
</properties>
<modules>
<module>brewspberry-regulator-algo</module>
<module>brewspberry-api</module>
<module>brewspberry-core</module>
<module>brewspberry-jbatches</module>
<module>brewspberry-webapp</module>
</modules>
<profiles>
<profile>
<id>rpm-build</id>
<activation>
<property>
<name>build-rpm</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<version>2.1</version>
<extensions>true</extensions>
<executions>
<execution>
<goals>
<goal>rpm</goal>
</goals>
<configuration>
<classifier>${rpm.classifier}</classifier>
<copyright>Biologeek</copyright>
<icon>src/main/resources/img/icon.png</icon>
<distribution>Brewspberry</distribution>
<targetOS>linux</targetOS>
<needarch>noarch</needarch>
<group>Internet</group>
<packager>${user.name}</packager>
<changelogFile>CHANGELOG</changelogFile>
<defaultDirmode>540</defaultDirmode>
<defaultFilemode>440</defaultFilemode>
<defaultUsername>tomcat</defaultUsername>
<defaultGroupname>tomcat</defaultGroupname>
<properties>
<project.build.sourceEncoding>utf-8</project.build.sourceEncoding>
<project.build.group>net.brewspberry</project.build.group>
</properties>
<requires>
<require>apache-tomcat >= 8.0.24</require>
</requires>
<mappings>
<mapping>
<directory>${rpm.install.webapps}/brewspberry-api</directory>
<sources>
<source>
<location>./brewspberry-api/target/brewspberry-api/target/brewspberry-api-0.1.0-SNAPSHOT.war</location>
</source>
</sources>
</mapping>
<mapping>
<directory>${rpm.install.webapps}/brewspberry-webapp</directory>
<sources>
<source>
<location>./brewspberry-webapp/target/brewspberry-webapp/target/brewspberry-api-0.1.0-SNAPSHOT.war</location>
</source>
</sources>
</mapping>
</mappings>
<postinstallScriptlet>
<scriptFile>
src/main/resources/rpm/postinstall.sh
</scriptFile>
<fileEncoding>utf-8</fileEncoding>
</postinstallScriptlet>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
I tried to modify it by adding or removing project.build.group but still does not work.
I always get this error.
Found several topics about 'sourceEncoding' missing or invalid issue but nothing about 'group' missing or invalid error.
The "group" parameter is not the usual "groupId" of the POM.
It refers instead to a group of RPMs which are usually defined in the file /usr/share/doc/rpm-$version/GROUPS
.
This is mentioned in the plugin docs.
You need to configure the RPM plugin with the right group; something like this:
<plugins >
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<version>2.1.5</version>
<configuration>
<group>Development/Tools</group>
</configuration>
</plugin>
...
</plugins>
This error occurs when you specify rpm plugin and its configuration in some one pom file and try to build from parent directory. In this case, maven will run goal rpm:rpm
on all projects, so rpm plugin will also be applied to all projects which may have no configuration for rpm plugin.
Move out this plugin to separate child module.
In your case, create e.g. rpm-package
module with entire profile:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>net.brewspberry</groupId>
<!-- I would rename it, parent is not rpm anymore -->
<artifactId>brewspberry-rpm-parent</artifactId>
<version>0.1.0-SNAPSHOT</version>
</parent>
<artifactId>rpm-package</artifactId>
...
<!-- move entire block "profiles" here -->
<profiles>
<profile>
<id>rpm-build</id>
...
</profile>
</profiles>
</project>
And in your parent pom.xml:
<modules>
...
<module>rpm-package</module>
</modules>
Do not forget to update mapping's source paths.
Now you can run:
mvn clean package
Additionally, see How do I make this plugin run only on non-Windows platforms? if you also build on Windows.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With