基於Maven 構建rpm包

rpm-maven-plugin是一個構建RPM的maven插件,他能在maven基礎上自動生成spec文件,並構建出rpm包出來java

<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>
相關文章
相關標籤/搜索