Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@rantav
Created October 14, 2010 11:25
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save rantav/626051 to your computer and use it in GitHub Desktop.
Save rantav/626051 to your computer and use it in GitHub Desktop.
mvn snippet to create an rpm for tomcat war
<pluginManagement>
<plugins>
<!--
The RPM plugin is used to create distributable apps from our war file.
To use it fire:
$ mvn install rpm:rpm
...
The resulting rpm is then found at Project/target/rpm/Project/RPMS/noarch/Project-versoin-1.noarch.rpm
For example: ImageServer/target/rpm/ImageServer/RPMS/noarch/ImageServer-6.5.0-1.noarch.rpm
-->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<version>2.1-alpha-1</version>
<configuration>
<group>outbrain</group>
<mappings>
<mapping>
<directory>${rpm.context.file.target}</directory>
<configuration>true</configuration>
<filemode>755</filemode>
<username>${rpm.file.owner}</username>
<groupname>${rpm.file.owner}</groupname>
<sources>
<source>
<location>${rpm.context.file.source}</location>
</source>
</sources>
</mapping>
<mapping>
<directory>/home/tomcat/wars</directory>
<filemode>755</filemode>
<username>${rpm.file.owner}</username>
<groupname>${rpm.file.owner}</groupname>
<!--
The following adtifact/classifiers/classifier voodoo is required to get the
projects main artifact into the rpm (and only the main artifact, without the
test artifact.
See http://mojo.codehaus.org/rpm-maven-plugin/map-params.html#artifact
-->
<artifact>
<classifiers>
<classifier/>
</classifiers>
</artifact>
</mapping>
</mappings>
<preinstallScriptlet>
<script>/etc/init.d/tomcat5 stop</script>
</preinstallScriptlet>
<postinstallScriptlet>
<script>
echo "removing ${apps.deploy.directory}"
rm -rf ${apps.deploy.directory}
echo "removing ${tomcat.work.directory}/*"
rm -rf ${tomcat.work.directory}/*
/etc/init.d/tomcat5 start
</script>
</postinstallScriptlet>
</configuration>
</plugin>
</plugins>
</pluginManagement>
@tayloryork
Copy link

What is rpm.context.file.source?
Thanks btw!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment