无法在项目inv项目上执行目标org.codehaus.mojo:rpm -maven-plugin:2.0.1:rpm(default-cli)

时间:2014-10-08 09:49:04

标签: java maven rpm-maven-plugin

创建我的Maven项目的RPM时,我收到以下错误。

我能够成功打包Jar,但RPM创建失败。

注意:我正在尝试使用Windows 7

[WARNING] operable program or batch file.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 42.696 s
[INFO] Finished at: 2014-10-08T15:06:40+05:30
[INFO] Final Memory: 23M/228M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:rpm-maven-plugin:2.0.1:rpm (default-cli) on project inv_project: RPM query for default vendor returned: '1' executing 'cmd.exe /X /C "rpm -E %{_host_vendor}"' -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:rpm-maven-plugin:2.0.1:rpm (default-cli) on project inv_project: RPM query for default vendor returned: '1' executing 'cmd.exe /X /C "rpm -E %{_host_vendor}"'
        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:116)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        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 query for default vendor returned: '1' executing 'cmd.exe /X /C "rpm -E %{_host_vendor}"'
        at org.codehaus.mojo.rpm.RPMHelper.getHostVendor(RPMHelper.java:76)
        at org.codehaus.mojo.rpm.AbstractRPMMojo.checkParams(AbstractRPMMojo.java:892)
        at org.codehaus.mojo.rpm.AbstractRPMMojo.execute(AbstractRPMMojo.java:714)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
        ... 19 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

以下是我正在使用的pom.xml

<plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>rpm-maven-plugin</artifactId>
        <version>2.0.1</version>
        <executions>
            <execution>
                <phase>install</phase>
                <goals><goal>rpm</goal></goals>
            </execution>
        </executions>
        <configuration>
            <group>Applications/Programming</group>
            <filemode>755</filemode>
            <copyright>LGPL</copyright>
            <mappings>
                <mapping>
                    <directory>target/</directory>
                    <sources>
                        <source><location>lib/</location></source>
                    </sources>
                </mapping>
            </mappings>
        </configuration>
      </plugin>

让我知道这里缺少什么?

3 个答案:

答案 0 :(得分:7)

rpm-maven-plugin只调用操作系统rpm命令,因此您需要在可以使用这些命令的RedHat或CentOS上运行它。此插件不会在其他操作系统上执行任何操作。

答案 1 :(得分:0)

在Windows上安装cygwin之后,由于上述问题得到解决,因此关闭此帖子。

但即便现在也没有生成rpm。 我正在结束这次讨论,并开始讨论新问题。

RPM file not generated using maven rpm plugin

答案 2 :(得分:0)

You need to have the rpm command. Different operating systems may have different ways to to install it. Cygwin is a way to have it in windows. I had the same problem in Ubuntu and solved it by:

sudo apt install rpm

So depending on the OS/Distribution you may have different ways to install RPM