title: How can I run my application on linux with rpm-maven-plugin?
body: <p>I would like to use rpm-maven-plugin to package my maven project to rpm file. After maven install (<code>mvn clean install</code>) the rpm is created in <code>target/rpm/rpm-build/RPMS/noarch/</code>.
  How can I start the application?
  If I try to install rpm with <code>yum localinstall {name}.rpm</code> I get a hint that nothing is todo:
  <a href="https://i.stack.imgur.com/M3r0J.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/M3r0J.png" alt="german error text" /></a>:</p>
  <p>I've created a text file after install to understand the routine.</p>
  <p>In my eyes the generated spec-file looks strange, because the tmp-buildroot/ is  empty:</p>
  <pre><code>%define __jar_repack 0
  Name: rpm-build
  Version: 0.5.0
  Release: SNAPSHOT20160809082044
  Summary: rpm-build
  License: (c) 2016 Nobody
  Vendor: Nobody
  URL: http://www.Nobody.com
  Group: Development
  Packager: Nobody
  autoprov: yes
  autoreq: yes
  BuildArch: noarch
  BuildRoot: /mnt/hgfs/workspace/test/rpm-build/target/rpm/rpm-build/buildroot
  
  %description
  test example: RPM Package.
  
  %install
  
  if [ -d $RPM_BUILD_ROOT ];
  then
    mv /mnt/hgfs/workspace/test/rpm-build/target/rpm/rpm-build/tmp-buildroot/* $RPM_BUILD_ROOT
  else
    mv /mnt/hgfs/workspace/test/rpm-build/target/rpm/rpm-build/tmp-buildroot $RPM_BUILD_ROOT
  fi
  
  %files
  
   &quot;/opt/app//lib/&quot;
  %config  &quot;/opt/app//conf&quot;
  %dir  &quot;/opt/app//logs&quot;
  
  %pre
  echo &quot;installing now&quot;
  
  %post
  #!/usr/bin/env bash
  
  touch file.txt
  </code></pre>
  <p>Which parameter is missing in my pom?</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot;
           xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
           xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;
      &lt;parent&gt;
          &lt;artifactId&gt;nobody&lt;/artifactId&gt;
          &lt;groupId&gt;com.nobody.nobody&lt;/groupId&gt;
          &lt;version&gt;0.5.0-SNAPSHOT&lt;/version&gt;
      &lt;/parent&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;artifactId&gt;rpm-build&lt;/artifactId&gt;
      &lt;inceptionYear&gt;2016&lt;/inceptionYear&gt;
      &lt;organization&gt;
          &lt;name&gt;nobody&lt;/name&gt;
          &lt;url&gt;http://www.nobody.com&lt;/url&gt;
      &lt;/organization&gt;
  
      &lt;properties&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
          &lt;app.home&gt;/opt/app/&lt;/app.home&gt;
      &lt;/properties&gt;
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;junit&lt;/groupId&gt;
              &lt;artifactId&gt;junit&lt;/artifactId&gt;
              &lt;version&gt;4.12&lt;/version&gt;
              &lt;scope&gt;compile&lt;/scope&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&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;2.1.5&lt;/version&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;rpm&lt;/goal&gt;
                          &lt;/goals&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
                  &lt;configuration&gt;
                      &lt;group&gt;Development&lt;/group&gt;
                      &lt;description&gt;example: RPM Package.&lt;/description&gt;
                      &lt;mappings&gt;
                          &lt;mapping&gt;
                              &lt;directory&gt;${app.home}/lib/&lt;/directory&gt;
                              &lt;dependency/&gt;
                              &lt;artifact/&gt;
                          &lt;/mapping&gt;
                          &lt;mapping&gt;
                              &lt;directory&gt;${app.home}/conf&lt;/directory&gt;
                              &lt;configuration&gt;true&lt;/configuration&gt;
                              &lt;sources&gt;
                                  &lt;source&gt;
                                      &lt;location&gt;${project.build.outputDirectory}/app.properties&lt;/location&gt;
                                      &lt;destination&gt;app.sample.properties&lt;/destination&gt;
                                  &lt;/source&gt;
                              &lt;/sources&gt;
                          &lt;/mapping&gt;
                          &lt;mapping&gt;
                              &lt;directory&gt;${app.home}/logs&lt;/directory&gt;
                          &lt;/mapping&gt;
                      &lt;/mappings&gt;
                      &lt;preinstallScriptlet&gt;
                          &lt;script&gt;echo &quot;installing now&quot;&lt;/script&gt;
                      &lt;/preinstallScriptlet&gt;
                      &lt;postinstallScriptlet&gt;
                          &lt;scriptFile&gt;src/main/scripts/postinstall.sh&lt;/scriptFile&gt;
                          &lt;fileEncoding&gt;utf-8&lt;/fileEncoding&gt;
                      &lt;/postinstallScriptlet&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;artifactId&gt;maven-assembly-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.5.3&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;descriptor&gt;src/assembly/dep.xml&lt;/descriptor&gt;
                  &lt;/configuration&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;id&gt;create-archive&lt;/id&gt;
                          &lt;phase&gt;package&lt;/phase&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;single&lt;/goal&gt;
                          &lt;/goals&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  <p>This is my project structure:</p>
  <p><a href="https://i.stack.imgur.com/WvC5r.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WvC5r.jpg" alt="project structure" /></a></p>
  <p>Currently sending my application just a <code>System.out.println</code> message.
  My goal is to create a linux daemon, I hope it is possible with the postinstall script.</p>
  <p>I hope someone has a hint for me. Thanks.</p>