首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >目标org.codehaus.mojo:rpm-maven-plugin:2.1.5:rpm的参数'group‘缺失或无效

目标org.codehaus.mojo:rpm-maven-plugin:2.1.5:rpm的参数'group‘缺失或无效
EN

Stack Overflow用户
提问于 2016-05-21 17:09:06
回答 5查看 7.7K关注 0票数 6

运行时

代码语言:javascript
复制
mvn clean rpm:rpm 

我得到这个错误:目标org.codehaus.mojo:rpm-maven-plugin:2.1.5:rpm的参数'group‘缺失或无效

我的父母pom.xml:

代码语言:javascript
复制
<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 &gt;= 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>

我试图通过添加或删除project.build.group来修改它,但仍然不起作用。

我总是收到这个错误。

找到几个关于'sourceEncoding‘缺失或无效问题的主题,但没有任何关于'group’缺失或无效错误的主题。

EN

回答 5

Stack Overflow用户

发布于 2017-02-03 16:23:25

"group“参数不是通常的POM的"groupId”。相反,它指的是通常在文件/usr/share/doc/rpm-$version/GROUPS中定义的RPM的组。plugin docs中提到了这一点。您需要使用正确的组配置RPM插件;如下所示:

代码语言:javascript
复制
<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>
票数 6
EN

Stack Overflow用户

发布于 2016-10-18 02:46:31

当您在某个pom文件中指定rpm插件及其配置并尝试从父目录构建时,会出现此错误。在这种情况下,maven将在所有项目上运行goal rpm:rpm,因此rpm插件也将应用于所有可能没有配置rpm插件的项目。

解决方案:

移出此插件以分离子模块。

在您的案例中,例如创建包含整个配置文件的rpm-package模块:

代码语言:javascript
复制
<?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>

在您的父pom.xml中:

代码语言:javascript
复制
<modules>
  ...
  <module>rpm-package</module>
</modules>

不要忘记更新映射的源路径。

现在您可以运行:

代码语言:javascript
复制
mvn clean package

此外,如果您也是在Windows上构建,请参阅How do I make this plugin run only on non-Windows platforms?

票数 2
EN

Stack Overflow用户

发布于 2017-03-22 00:43:39

在我的例子中,我需要添加...

代码语言:javascript
复制
<properties>
    <project.build.sourceEncoding>utf-8</project.build.sourceEncoding>
</properties>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37360960

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档