11

I am getting the error below while creating an RPM of my Maven Project.

I am able to package the Jar successfully but RPM creation is failing.

Note: I am trying on 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

<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?

Richard Neish
  • 8,414
  • 4
  • 39
  • 69
user001
  • 991
  • 6
  • 16
  • 34
  • Could [this](http://stackoverflow.com/questions/20728174/cygwin-maven-rpm-segmentation-fault) be related? – Raghuram Oct 08 '14 at 09:55
  • First suggestion would be to use a up-to-date version of [rpm-maven-plugin](http://mojo.codehaus.org/rpm-maven-plugin/). Furhtermore why not creating RPM's on the appropriate platforms (like Linux) instead of Windows 7. – khmarbaise Oct 08 '14 at 18:45
  • I am able to overcome this issue now by installing cygwin. But now even though the build is successful, I don't see .rpm files getting generated instead under target directory rpm folder is created. Can anyone please guide me as I am new to rpm world – user001 Oct 09 '14 at 05:37

4 Answers4

13

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.

Richard Neish
  • 8,414
  • 4
  • 39
  • 69
  • I have installed cygwin on my machine now and running the following cmd to generate rpm "mvn clean package rpm:rpm". Now the build is success and in the target dir, a new folder named rpm is created with all the necessary files I need. But again there is no .rpm file generated. – user001 Oct 09 '14 at 10:13
  • What happens if you run `rpm` from the Cygwin bash shell? That is exactly what the plugin is doing. – Richard Neish Oct 09 '14 at 10:33
  • On hit of rpm I get, RPM version 4.11.1 Copyright (C) 1998-2002 - Red Hat, Inc. This program may be freely redistributed under the terms of the GNU GPL Usage: rpm [-afgpcdLlsiv?] [-a|--all] [-f|--file] [-g|--group] [-p|--package] [--pkgid] [--hdrid] [--triggeredby] [--whatrequires] [--whatprovides] [--nomanifest] [-c|--configfiles] [-d|--docfiles] [-L|--licensefiles] [--dump] [-l|--list] [--queryformat=QUERYFORMAT] [-s|--state] [--nofiledigest] [--nofiles] [--nodeps] [--noscript] [--allfiles] [--allmatches] [--badreloc] [-e|--erase=+] [--excludedocs] – user001 Oct 09 '14 at 11:05
8

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

borjab
  • 11,149
  • 6
  • 71
  • 98
  • Even I am facing the same error on Ubuntu. But I have rpm already installed. The version is RPM version 4.14.2.1. Any idea as to how to resolve this issue? – Autumn Mar 12 '21 at 18:52
0

Closing this post as the above issue got resolved after installing cygwin on windows.

But even now rpm is not generated. I am closing this discussion and opening a new one to discuss on the new issue.

RPM file not generated using maven rpm plugin

user001
  • 991
  • 6
  • 16
  • 34
0

Is necesary install rpm-build package yum install rpm-build

  • This does not really answer the question. If you have a different question, you can ask it by clicking [Ask Question](https://stackoverflow.com/questions/ask). To get notified when this question gets new answers, you can [follow this question](https://meta.stackexchange.com/q/345661). Once you have enough [reputation](https://stackoverflow.com/help/whats-reputation), you can also [add a bounty](https://stackoverflow.com/help/privileges/set-bounties) to draw more attention to this question. - [From Review](/review/late-answers/30297602) – AfterFray Nov 10 '21 at 06:11