title: Maven - generate an RPM and Jar using a single POM file
body: <p>I am working on Maven RPM Plugin and I have my directory structure as below</p>
  
  <pre><code>  dir1
    dir2
    dir3
    src
    pom.xml
  </code></pre>
  
  <p>dir1,dir2,dir3 directories contain my custom files and the src directory has my Java source code. </p>
  
  <p>I want to create the Jar file by building the Java application and then bundle everything to an RPM(dir1,dir2,dir3,src, jar file generated). I have tried the below </p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
    &lt;groupId&gt;xyz&lt;/groupId&gt;
    &lt;artifactId&gt;abc&lt;/artifactId&gt;
    &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
    &lt;packaging&gt;jar&lt;/packaging&gt;
  
    &lt;name&gt;xyz&lt;/name&gt;
    &lt;url&gt;http://maven.apache.org&lt;/url&gt;
  
    &lt;properties&gt;
      &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
          &lt;build.number&gt;1&lt;/build.number&gt;
          &lt;maven.rpm.plugin.version&gt;2.0.1&lt;/maven.rpm.plugin.version&gt;
    &lt;/properties&gt;
  &lt;profiles&gt;
      &lt;profile&gt;
              &lt;id&gt;rpm&lt;/id&gt;
              &lt;activation&gt;
                  &lt;activeByDefault&gt;true&lt;/activeByDefault&gt;
              &lt;/activation&gt;
              &lt;build&gt;
                  &lt;plugins&gt;
                      &lt;plugin&gt;
                          &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
                          &lt;artifactId&gt;rpm-maven-plugin&lt;/artifactId&gt;
                          &lt;version&gt;${maven.rpm.plugin.version}&lt;/version&gt;
                          &lt;executions&gt;
                              &lt;execution&gt;
                                     &lt;id&gt;generate-rpm&lt;/id&gt;
                                      &lt;goals&gt;
                                           &lt;goal&gt;rpm&lt;/goal&gt;
                                  &lt;/goals&gt;
                              &lt;/execution&gt;
                          &lt;/executions&gt;
                          &lt;configuration&gt;
                              &lt;name&gt;${project.artifactId}&lt;/name&gt;
                              &lt;copyright&gt;XYZ&lt;/copyright&gt;
                              &lt;release&gt;${build.number}&lt;/release&gt;
                              &lt;group&gt;DOC/COD&lt;/group&gt;
                              &lt;mappings&gt;
                                  &lt;mapping&gt;
                                  &lt;directory&gt;/tmp&lt;/directory&gt;
                                  &lt;/mapping&gt;
                              &lt;/mappings&gt;
                          &lt;/configuration&gt;
                      &lt;/plugin&gt;
                  &lt;/plugins&gt;
              &lt;/build&gt;
          &lt;/profile&gt;
      &lt;/profiles&gt;
    &lt;dependencies&gt;
  
      &lt;dependency&gt;
    &lt;groupId&gt;com.googlecode.json-simple&lt;/groupId&gt;
    &lt;artifactId&gt;json-simple&lt;/artifactId&gt;
    &lt;version&gt;1.1&lt;/version&gt;
  &lt;/dependency&gt;
  
      &lt;dependency&gt;
        &lt;groupId&gt;junit&lt;/groupId&gt;
        &lt;artifactId&gt;junit&lt;/artifactId&gt;
        &lt;version&gt;3.8.1&lt;/version&gt;
        &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
    &lt;/dependencies&gt;
  
    &lt;repositories&gt;
  
  &lt;/repositories&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>The target directory is being created with the JAR file of the Java source code but the RPM is not getting created. It throws the below error</p>
  
  <pre><code>  Failed to execute goal org.codehaus.mojo:rpm-maven-plugin:2.0.1:rpm (generate-rpm) on   project xyz: RPM query for default vendor returned: '127' executing '/bin/sh -c rpm -E '%{_host_vendor}'' -&gt; [Help 1]
  </code></pre>
  
  <p>Please let me know if I am in the right direction and how to proceed on this.</p>