我正在尝试使用Windows上的RPM Maven插件来构buildRPM,以便在Linux机器上部署。
build立RPM的机器的操作系统:Windows 7 Enterprise,Cygwin 2.5.1
VM安装RPM的操作系统:CentOS 7
我运行了mvn clean install命令,并且构build成功。
[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] ------------------------------------------------------------------------
但是,当我scp到服务器并运行yum install -y Core1337-1.0-1.noarch.rpm
我得到以下错误:
Transaction check error: package Core1337-1.0-1.noarch is intended for a different operating system
以下是从插件的Pom.XML文件中剪下来的XML。
<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>
这是生成的SPEC文件:
%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"
我怎样才能configuration插件与Linux头build立一个RPM? 任何帮助深表感谢 !
在Windows上构建RPMS以部署在Linux机器上可能会很复杂。 我会建议在部署它的同一个操作系统上构建RPMS。