title: Build RPM for Linux CentOS on Windows
body: <p>I'm trying to build an RPM using the RPM Maven Plugin on Windows for deployment on a Linux machine.</p>
  <blockquote>
  <p>OS of machine that's building RPM: Windows 7 Enterprise, Cygwin 2.5.1</p>
  <p>OS of VM installing RPM: CentOS 7</p>
  </blockquote>
  <p>I've run the mvn clean install command and the build is successful.</p>
  <pre><code>[INFO] ------------------------------------------------------------------------
  [INFO] BUILD SUCCESS
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time: 48.273s
  [INFO] Finished at: Sun Apr 24 21:08:51 BST 2016
  [INFO] Final Memory: 10M/157M
  [INFO] ------------------------------------------------------------------------
  </code></pre>
  <p>However, when I scp this over to the server and run <code>yum install -y Core1337-1.0-1.noarch.rpm</code></p>
  <p>I get the following error:</p>
  <pre><code>Transaction check error:   package Core1337-1.0-1.noarch is
   intended for a different operating system
  </code></pre>
  <p>The following is the XML snipped from the Pom.XML file for the Plugin.</p>
  <pre><code>    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;com.core&lt;/groupId&gt;
      &lt;artifactId&gt;Core1337&lt;/artifactId&gt;
      &lt;packaging&gt;rpm&lt;/packaging&gt;
      &lt;version&gt;1.0&lt;/version&gt;
      &lt;name&gt;Core Libz&lt;/name&gt;
  
      &lt;properties&gt;
          &lt;targetOS&gt;i386-linux&lt;/targetOS&gt;
          &lt;rpm-base&gt;opt&lt;/rpm-base&gt;
          &lt;rpm-path&gt;app&lt;/rpm-path&gt;
          &lt;base-dir&gt;core&lt;/base-dir&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
      &lt;/properties&gt;
  
      &lt;dependencies&gt;
      &lt;/dependencies&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;extensions&gt;true&lt;/extensions&gt;
              &lt;configuration&gt;
                  &lt;license&gt;GPL (c) 2005, SWWDC&lt;/license&gt;
                  &lt;distribution&gt;eSQuireDistro&lt;/distribution&gt;
                  &lt;group&gt;eSQuireDevel&lt;/group&gt;
                  &lt;requires&gt;
                      &lt;require&gt;at&lt;/require&gt;
                      &lt;require&gt;wget&lt;/require&gt;
                      &lt;require&gt;tree&lt;/require&gt;
                      &lt;require&gt;cronie&lt;/require&gt;
                      &lt;require&gt;openssh-server&lt;/require&gt;
                  &lt;/requires&gt;
                  &lt;mappings&gt;
                      &lt;mapping&gt;
                          &lt;directory&gt;/${rpm-base}/${rpm-path}/${base-dir}/python&lt;/directory&gt;
                          &lt;filemode&gt;744&lt;/filemode&gt;
                          &lt;username&gt;root&lt;/username&gt;
                          &lt;groupname&gt;root&lt;/groupname&gt;
                          &lt;configuration&gt;false&lt;/configuration&gt;
                          &lt;directoryIncluded&gt;true&lt;/directoryIncluded&gt;
                          &lt;recurseDirectories&gt;true&lt;/recurseDirectories&gt;
                          &lt;dependency /&gt;
                          &lt;sources&gt;
                              &lt;source&gt;
                                  &lt;location&gt;src/main/python&lt;/location&gt;
                              &lt;/source&gt;
                          &lt;/sources&gt;
                      &lt;/mapping&gt;
                      &lt;mapping&gt;
                          &lt;directory&gt;/${rpm-base}/${rpm-path}/${base-dir}/scripts&lt;/directory&gt;
                          &lt;filemode&gt;744&lt;/filemode&gt;
                          &lt;username&gt;root&lt;/username&gt;
                          &lt;groupname&gt;root&lt;/groupname&gt;
                          &lt;configuration&gt;false&lt;/configuration&gt;
                          &lt;directoryIncluded&gt;true&lt;/directoryIncluded&gt;
                          &lt;recurseDirectories&gt;true&lt;/recurseDirectories&gt;
                          &lt;dependency /&gt;
                          &lt;sources&gt;
                              &lt;source&gt;
                                  &lt;location&gt;src/main/scripts&lt;/location&gt;
                              &lt;/source&gt;
                          &lt;/sources&gt;
                      &lt;/mapping&gt;
                  &lt;/mappings&gt;
                  &lt;preinstallScriptlet&gt;
                      &lt;script&gt;/bin/logger &quot;installing&quot;&lt;/script&gt;
                  &lt;/preinstallScriptlet&gt;
                  &lt;postinstallScriptlet&gt;
                      &lt;script&gt;/bin/logger &quot;uninstalling&quot;&lt;/script&gt;
                  &lt;/postinstallScriptlet&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  </code></pre>
  <p>This is the generated SPEC file:</p>
  <pre><code>%define __jar_repack 0
  Name: Core1337
  Version: 1.0
  Release: 1
  Summary: Core Libz
  License: GPL (c) 2005, SWWDC
  Distribution: eSQuireDistro
  Group: eSQuireDevel
  Requires: at
  Requires: wget
  Requires: tree
  Requires: cronie
  Requires: openssh-server
  autoprov: yes
  autoreq: yes
  BuildArch: noarch
  BuildRoot: /cygdrive/C/Users/ala/workspace/alan/Core/target/rpm/Core1337/buildroot
  
  %description
  
  %install
  
  if [ -d $RPM_BUILD_ROOT ];
  then
    mv /cygdrive/C/Users/ala/workspace/alan/Core/target/rpm/Core1337/tmp-buildroot/* $RPM_BUILD_ROOT
  else
    mv /cygdrive/C/Users/ala/workspace/alan/Core/target/rpm/Core1337/tmp-buildroot $RPM_BUILD_ROOT
  fi
  
  %files
  
  %attr(744,root,root)  &quot;/opt/esquire/core/python/&quot;
  %attr(744,root,root)  &quot;/opt/esquire/core/scripts/&quot;
  
  %pre
  /bin/logger &quot;installing&quot;
  
  %post
  /bin/logger &quot;uninstalling&quot;
  </code></pre>
  <p>How can I configure the plugin to build an RPM with the linux header? Any help is much appreciated !</p>