码迷,mamicode.com
首页 > 其他好文 > 详细

基于Maven 构建rpm包

时间:2015-10-23 16:50:10      阅读:179      评论:0      收藏:0      [点我收藏+]

标签:

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>


基于Maven 构建rpm包

标签:

原文地址:http://my.oschina.net/u/3802/blog/521215

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!