Java 无法在项目 inv-project 上执行目标 org.codehaus.mojo:rpm-maven-plugin:2.0.1:rpm (default-cli)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26253926/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Failed to execute goal org.codehaus.mojo:rpm-maven-plugin:2.0.1:rpm (default-cli) on project inv-project
提问by user001
I am getting the error below while creating an RPM of my Maven Project.
创建 Maven 项目的 RPM 时出现以下错误。
I am able to package the Jar successfully but RPM creation is failing.
我能够成功打包 Jar,但 RPM 创建失败。
Note:I am trying on Windows 7
注意:我正在 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
Below is the pom.xml I am using
下面是我正在使用的 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>
Let me know what is missing here?
让我知道这里缺少什么?
回答by Richard Neish
The rpm-maven-plugin just calls the operating system rpm
commands, so you need to run it on RedHat or CentOS where those commands are available. This plugin will not do anything on other operating systems.
rpm-maven-plugin 只调用操作系统rpm
命令,因此您需要在这些命令可用的 RedHat 或 CentOS 上运行它。这个插件不会在其他操作系统上做任何事情。
回答by user001
Closing this post as the above issue got resolved after installing cygwin on windows.
关闭此帖子,因为在 Windows 上安装 cygwin 后上述问题已解决。
But even now rpm is not generated. I am closing this discussion and opening a new one to discuss on the new issue.
但即使现在 rpm 也不会生成。我要结束这个讨论并打开一个新的讨论新问题。
回答by borjab
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:
你需要有 rpm 命令。不同的操作系统可能有不同的安装方式。Cygwin 是一种在 Windows 中使用它的方法。我在 Ubuntu 中遇到了同样的问题并通过以下方式解决了它:
sudo apt install rpm
So depending on the OS/Distribution you may have different ways to install RPM
因此,根据操作系统/发行版,您可能有不同的方式来安装 RPM