利用rpm-maven-plugin插件实现讲javaweb或者java程序打包成rpm包,以便于RPM软件仓库管理
在项目pom文件的插件配置中,增加 rpm-maven-plugin的配置
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<version>2.1.5</version>
<extensions>true</extensions>
<executions>
<execution>
<goals>
<goal>rpm</goal>
</goals>
</execution>
</executions>
<configuration>
<prefix>${tomcat_home}</prefix><!-- tomcat目录 -->
<copyright>2017, zhuxj</copyright>
<distribution>zhuxj</distribution>
<group>zhuxj.com</group>
<packager>zhuxj</packager>
<version>${project.version}</version>
<autoRequires>true</autoRequires>
<release>1.el6</release>
<requires>
<require>java-1.7.0 >= 1.7</require>
</requires>
<mappings>
<mapping>
<directory>${tomcat_home}/webapps/ROOT</directory><!-- web安装目录 -->
<filemode>755</filemode>
<username>tomcat</username>
<groupname>tomcat</groupname>
<sources>
<source>
<location>target/${project.artifactId}-${project.version}</location>
</source>
</sources>
</mapping>
</mappings>
</configuration>
</plugin>
# yum install rpm-build
迁出源码到linux主机,执行打包命令,即可在target/rpm/目录下生成rpm包
# mvn package