rpm-maven-plugin是一个构建RPM的maven插件,他能在maven基础上自动生成spec文件,并构建出rpm包出来
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<version>2.1.4</version>
<extensions>true</extensions>
<configuration>
<license>${rpm.license}</license>
<group>${rpm.group}</group>
<packager>${rpm.packager}</packager>
<prefix>${rpm.prefix}</prefix>
<autoProvides>false</autoProvides>
<autoRequires>false</autoRequires>
<needarch>noarch</needarch>
<targetOS>linux</targetOS>
<requires combine.children="append">
</requires>
<mappings>
<mapping>
<directory>${install.path}/cfgcenter-agent-${version}/lib/</directory>
<dependency />
<artifact />
</mapping>
<mapping>
<directory>${install.path}/cfgcenter-agent-${version}/conf/</directory>
<sources>
<source>
<location>src/main/resources</location>
</source>
</sources>
</mapping>
<mapping>
<directory>${install.path}/cfgcenter-agent-${version}</directory>
<sources>
<source>
<location>script</location>
</source>
</sources>
</mapping>
</mappings>
<postinstallScriptlet>
<script>sudo find ${install.path}/cfgcenter-agent-${version} -iname "*.sh" -exec dos2unix '{}' \; ; sudo find ${install.path}/cfgcenter-agent-${version} -iname "*.conf" -exec dos2unix '{}' \; ; sudo chown -R apps.apps ${install.path}/cfgcenter-agent-${version} </script>
</postinstallScriptlet>
<preremoveScriptlet>
<script>rm -rf ${install.path}/cfgcenter-agent-${version}</script>
</preremoveScriptlet>
</configuration>
<executions>
<execution>
<goals>
<goal>rpm</goal>
</goals>
</execution>
</executions>
</plugin>