I'm trying to build an RPM using the RPM Maven Plugin on Windows for deployment on a Linux machine.
OS of machine that's building RPM: Windows 7 Enterprise, Cygwin 2.5.1
OS of VM installing RPM: CentOS 7
I've run the mvn clean install command and the build is successful.
[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] ------------------------------------------------------------------------
However, when I scp this over to the server and run yum install -y Core1337-1.0-1.noarch.rpm
I get the following error:
Transaction check error: package Core1337-1.0-1.noarch is
intended for a different operating system
The following is the XML snipped from the Pom.XML file for the Plugin.
<modelVersion>4.0.0</modelVersion>
<groupId>com.core</groupId>
<artifactId>Core1337</artifactId>
<packaging>rpm</packaging>
<version>1.0</version>
<name>Core Libz</name>
<properties>
<targetOS>i386-linux</targetOS>
<rpm-base>opt</rpm-base>
<rpm-path>app</rpm-path>
<base-dir>core</base-dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
</dependencies>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<version>2.1.5</version>
<extensions>true</extensions>
<configuration>
<license>GPL (c) 2005, SWWDC</license>
<distribution>eSQuireDistro</distribution>
<group>eSQuireDevel</group>
<requires>
<require>at</require>
<require>wget</require>
<require>tree</require>
<require>cronie</require>
<require>openssh-server</require>
</requires>
<mappings>
<mapping>
<directory>/${rpm-base}/${rpm-path}/${base-dir}/python</directory>
<filemode>744</filemode>
<username>root</username>
<groupname>root</groupname>
<configuration>false</configuration>
<directoryIncluded>true</directoryIncluded>
<recurseDirectories>true</recurseDirectories>
<dependency />
<sources>
<source>
<location>src/main/python</location>
</source>
</sources>
</mapping>
<mapping>
<directory>/${rpm-base}/${rpm-path}/${base-dir}/scripts</directory>
<filemode>744</filemode>
<username>root</username>
<groupname>root</groupname>
<configuration>false</configuration>
<directoryIncluded>true</directoryIncluded>
<recurseDirectories>true</recurseDirectories>
<dependency />
<sources>
<source>
<location>src/main/scripts</location>
</source>
</sources>
</mapping>
</mappings>
<preinstallScriptlet>
<script>/bin/logger "installing"</script>
</preinstallScriptlet>
<postinstallScriptlet>
<script>/bin/logger "uninstalling"</script>
</postinstallScriptlet>
</configuration>
</plugin>
</plugins>
This is the generated SPEC file:
%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) "/opt/esquire/core/python/"
%attr(744,root,root) "/opt/esquire/core/scripts/"
%pre
/bin/logger "installing"
%post
/bin/logger "uninstalling"
How can I configure the plugin to build an RPM with the linux header? Any help is much appreciated !
Building RPMS on windows for deployment on linux machines might be complicated. I would suggest building the RPMS on the same OS on which it will be deployed.