我有一個包含多個pom圖層的microservices項目。我設置了使用'org.codehaus.mojo:rpm-maven-plugin:2.1.1'插件爲每個服務生成rpms。我需要將它設置爲生成一個rpm,並將所有這些rpms作爲所需的依賴關係。如何設置maven父pom從子rpms構建rpm
在父pom中,我添加了沒有源的設置,但需要兩個rpm包。當我向父母添加相同的設置時,它會失敗,我不明白我缺少什麼。
例如: 項目組 --ProjectCommon --Project1 --Project2
所以ProjectCommon,PROJECT1和Project2中都產生並部署到我們的倉庫沿着他們的勁歌和戰爭自己的RPM。 Project1和Project2需要通用並且可行。我想要做的是把它放在父pom中,所以它會建立一個需要孩子們的rpm。然後,不必安裝每個rpm,我可以安裝1個父級rpm,並將其拉出/安裝所有其他rpm。
我應該補充說,在這個之上有兩個級別的父級poms,因爲我們將這些服務分組爲業務服務和數據訪問服務。然後還從其他組件的服務組合在一起,例如gui/etc,它們有自己的poms。但是,如果我將它與父母的父母一起工作,那麼它也應該爲他們的父母工作。
這是我加入到父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] Failed to execute goal org.codehaus.mojo:rpm-maven-plugin:2.1.1:attached-rpm (attach-rpm) on project project-business-parent: RPM build execution returned: '1' executing '/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: Failed to execute goal org.codehaus.mojo:rpm-maven-plugin:2.1.1:attached-rpm (attach-rpm) on project project-business-parent: RPM build execution returned: '1' executing '/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'' at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214) at org.apache.maven.cli.MavenCli.main(MavenCli.java:158) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) Caused by: org.apache.maven.plugin.MojoExecutionException: RPM build execution returned: '1' executing '/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'' at org.codehaus.mojo.rpm.RPMHelper.buildPackage(RPMHelper.java:149) at org.codehaus.mojo.rpm.AbstractRPMMojo.execute(AbstractRPMMojo.java:633) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) ... 19 more
編輯:新增「mvn -X install」的詳細錯誤。謝謝jdevelop!
請發佈「mvn -X ...」的輸出,這將提供更多信息,說明爲什麼該shell腳本無法啓動。 – jdevelop 2015-04-02 01:54:41