我有一个多层pom的微服务项目。我已经设置好使用“org.codehaus.mojo:rpm-maven-plugin:2.1.1”插件为每个服务生成rpm。我需要将其设置为生成一个包含所有这些rpm作为必需依赖项的rpm。
在父POM中,我添加了设置以不需要源代码但需要两个rpm包的方式。当我将相同的设置添加到父级时,它会失败,我不明白我缺少了什么。
例如: 项目组 - 项目公共部分 - 项目1 - 项目2
因此,ProjectCommon、Project1和Project2都有自己的rpm生成并部署到我们的存储库中,同时也有它们的pom和war。Project1和Project2需要common,这很有效。我想做的是将相同的内容放入父POM中,以便构建需要子项的rpm。然后,我可以安装一个父级rpm而不是每个rpm,它将拉取/安装所有其他rpm。
我应该补充说,这个父POM上面还有两个级别的父POM,因为我们将服务分组为业务服务和数据访问服务。然后,还将来自其他组件(如GUI/等)的服务分组在一起,它们有自己的POM。但如果我能使它与直接父POM一起工作,那么它也应该适用于它们的父级。
这是我添加到父POM中的内容:
这里是错误信息:
[ERROR] 在项目project-business-parent上执行目标org.codehaus.mojo:rpm-maven-plugin:2.1.1:attached-rpm(attach-rpm)时失败:RPM构建执行返回:'1',执行'/bin/sh -c cd '/workspace/project-pom/services/business/target/rpm/project-business-parent/SPECS' && 'rpmbuild' '-bb' '--target' 'noarch-pc-linux' '--buildroot' '/workspace/project-pom/services/business/target/rpm/project-business-parent/buildroot' '--define' '_topdir /workspace/project-pom/services/business/target/rpm/project-business-parent' 'project-business-parent.spec'' -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: 在项目project-business-parent上执行目标org.codehaus.mojo:rpm-maven-plugin:2.1.1:attached-rpm(attach-rpm)时失败:RPM构建执行返回:'1',执行'/bin/sh -c cd '/workspace/project-pom/services/business/target/rpm/project-business-parent/SPECS' && 'rpmbuild' '-bb' '--target' 'noarch-pc-linux' '--buildroot' '/workspace/project-pom/services/business/target/rpm/project-business-parent/buildroot' '--define' '_topdir /workspace/project-pom/services/business/target/rpm/project-business-parent' 'project-business-parent.spec'' org.apache.maven.plugin.MojoExecutionException: RPM构建执行返回:'1',执行'/bin/sh -c cd '/workspace/project-pom/services/business/target/rpm/project-business-parent/SPECS' && 'rpmbuild' '-bb' '--target' 'noarch-pc-linux' '--buildroot' '/workspace/project-pom/services/business/target/rpm/project-business-parent/buildroot' '--define' '_topdir /workspace/project-pom/services/business/target/rpm/project-business-parent' 'project-business-parent.spec'' 在执行命令'/workspace/project-pom/services/business/target/rpm/project-business-parent/SPECS' && 'rpmbuild' '-bb' '--target' 'noarch-pc-linux' '--buildroot' '/workspace/project-pom/services/business/target/rpm/project-business-parent/buildroot' '--define' '_topdir /workspace/project-pom/services/business/target/rpm/project-business-parent' 'project-business-parent.spec''时,RPM构建返回了1。
在父POM中,我添加了设置以不需要源代码但需要两个rpm包的方式。当我将相同的设置添加到父级时,它会失败,我不明白我缺少了什么。
例如: 项目组 - 项目公共部分 - 项目1 - 项目2
因此,ProjectCommon、Project1和Project2都有自己的rpm生成并部署到我们的存储库中,同时也有它们的pom和war。Project1和Project2需要common,这很有效。我想做的是将相同的内容放入父POM中,以便构建需要子项的rpm。然后,我可以安装一个父级rpm而不是每个rpm,它将拉取/安装所有其他rpm。
我应该补充说,这个父POM上面还有两个级别的父POM,因为我们将服务分组为业务服务和数据访问服务。然后,还将来自其他组件(如GUI/等)的服务分组在一起,它们有自己的POM。但如果我能使它与直接父POM一起工作,那么它也应该适用于它们的父级。
这是我添加到父POM中的内容:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<version>2.1.1</version>
<executions>
<execution>
<id>attach-rpm</id>
<goals>
<goal>attached-rpm</goal>
</goals>
<configuration>
<sourceEncoding>${project.build.sourceEncoding}</sourceEncoding>
<group>${rpm.group}</group>
<requires>
<require>project1 > ${project.version}</require>
<require>project2 > ${project.version}</require>
</requires>
<mappings>
<mapping>
<directory>${rpm.directory}</directory>
<filemode>$rpm.permissions}</filemode>
<username>${rpm.user}</username>
<groupname>${rpm.usergroup}</groupname>
</mapping>
</mappings>
</configuration>
</execution>
</executions>
</plugin>
这是其中一个孩子:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<version>2.1.1</version>
<executions>
<execution>
<id>attach-rpm</id>
<goals>
<goal>attached-rpm</goal>
</goals>
<configuration>
<sourceEncoding>${project.build.sourceEncoding}</sourceEncoding>
<group>${rpm.group}</group>
<requires>
<require>weblogic</require>
<require>project1 > ${project.version}</require>
</requires>
<mappings>
<mapping>
<directory>${rpm.directory}/config</directory>
<filemode>$rpm.permissions}</filemode>
<username>${rpm.user}</username>
<groupname>${rpm.usergroup}</groupname>
<sources>
<source>
<location>${project.build.directory}/${project.build.finalName}.${project.packaging}</location>
</source>
</sources>
</mapping>
</mappings>
</configuration>
</execution>
</executions>
</plugin>
这里是错误信息:
[ERROR] 在项目project-business-parent上执行目标org.codehaus.mojo:rpm-maven-plugin:2.1.1:attached-rpm(attach-rpm)时失败:RPM构建执行返回:'1',执行'/bin/sh -c cd '/workspace/project-pom/services/business/target/rpm/project-business-parent/SPECS' && 'rpmbuild' '-bb' '--target' 'noarch-pc-linux' '--buildroot' '/workspace/project-pom/services/business/target/rpm/project-business-parent/buildroot' '--define' '_topdir /workspace/project-pom/services/business/target/rpm/project-business-parent' 'project-business-parent.spec'' -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: 在项目project-business-parent上执行目标org.codehaus.mojo:rpm-maven-plugin:2.1.1:attached-rpm(attach-rpm)时失败:RPM构建执行返回:'1',执行'/bin/sh -c cd '/workspace/project-pom/services/business/target/rpm/project-business-parent/SPECS' && 'rpmbuild' '-bb' '--target' 'noarch-pc-linux' '--buildroot' '/workspace/project-pom/services/business/target/rpm/project-business-parent/buildroot' '--define' '_topdir /workspace/project-pom/services/business/target/rpm/project-business-parent' 'project-business-parent.spec'' org.apache.maven.plugin.MojoExecutionException: RPM构建执行返回:'1',执行'/bin/sh -c cd '/workspace/project-pom/services/business/target/rpm/project-business-parent/SPECS' && 'rpmbuild' '-bb' '--target' 'noarch-pc-linux' '--buildroot' '/workspace/project-pom/services/business/target/rpm/project-business-parent/buildroot' '--define' '_topdir /workspace/project-pom/services/business/target/rpm/project-business-parent' 'project-business-parent.spec'' 在执行命令'/workspace/project-pom/services/business/target/rpm/project-business-parent/SPECS' && 'rpmbuild' '-bb' '--target' 'noarch-pc-linux' '--buildroot' '/workspace/project-pom/services/business/target/rpm/project-business-parent/buildroot' '--define' '_topdir /workspace/project-pom/services/business/target/rpm/project-business-parent' 'project-business-parent.spec''时,RPM构建返回了1。
编辑:添加了更详细的错误信息,使用“mvn -X install”命令。感谢jdevelop!