Does anyone know of any web applications that are built with Maven to an RPM? The RPM Maven Plugin provides the functionality to build to an RPM, but it's documentation is lacking.
Specifically, I'm looking for an example that would include multiple modules, i.e. Chapter 8. A Multi-module Project, from the "Maven by Example" series.
An example with only a single module would be:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.app</groupId>
<artifactId>my-webapp</artifactId>
<packaging>war</packaging>
<version>1.0-SOME-SNAPSHOT</version>
<name>my-webapp</name>
<url>http://maven.apache.org</url>
<properties>
<rpm.install.basedir>/opt/tomcat6</rpm.install.basedir>
<rpm.install.webapps>${rpm.install.basedir}/webapps</rpm.install.webapps>
<rpm.install.config>${rpm.install.basedir}/lib</rpm.install.config>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<!-- Servlet -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>jstl-api</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>jstl-impl</artifactId>
<version>1.2</version>
</dependency>
<!-- Jackson JSON Processor -->
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.8.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<version>2.1-alpha-1</version>
<extensions>true</extensions>
<executions>
<execution>
<goals>
<goal>attached-rpm</goal>
</goals>
</execution>
</executions>
<configuration>
<copyright>My Company</copyright>
<distribution>My Distribution</distribution>
<group>Applications/Internet</group>
<packager>${user.name}</packager>
<changelogFile>CHANGELOG</changelogFile>
<defaultDirmode>500</defaultDirmode>
<defaultFilemode>400</defaultFilemode>
<defaultUsername>tomcat6</defaultUsername>
<defaultGroupname>tomcat6</defaultGroupname>
<requires>
<require>apache-tomcat >= 6.0.20-2</require>
</requires>
<mappings>
<!-- webapps deployment -->
<mapping>
<directory>${rpm.install.webapps}/${project.artifactId}</directory>
<sources>
<source>
<location>target/${project.artifactId}-${project.version}</location>
</source>
</sources>
</mapping>
<!-- configuration files -->
<mapping>
<directory>${rpm.install.config}</directory>
<configuration>true</configuration>
<sources>
<source>
<location>src/main/resources/my-webapp.jdbc.properties.sample</location>
</source>
<source>
<location>src/main/resources/my-webapp.runtime.properties</location>
<destination>my-webapp.runtime.properties.sample</destination>
</source>
</sources>
</mapping>
<!-- (Optional) Create other necessary directory structure -->
<mapping>
<directory>${rpm.install.basedir}/my-webapp-workspace</directory>
<filemode>750</filemode>
<username>tomcatuser</username>
<groupname>tomcatuser</groupname>
</mapping>
</mappings>
<!-- (Optional) -->
<preinstallScriptlet>
<scriptFile>src/main/scripts/rpm/pre-install.sh</scriptFile>
</preinstallScriptlet>
<!-- (Optional) -->
<postinstallScriptlet>
<script>echo "WARNING: Restart tomcat to ensure changes take effect."</script>
</postinstallScriptlet>
</configuration>
</plugin>
</plugins>
</build>
</project>
Thanks for any/all help!
So, it turns out the example that I gave in asking my question was quite wrong, which probably contributed to why I didn't get the complete answer I was looking for. What I was really looking for was an RPM to install to a server, that depended on a servlet container (i.e. Tomcat) and would install the included Web Applications (webapps) to Tomcat's webapps directory.
As such, here is the proper answer:
The thing to note about this is that I was looking for a "multi-module" project, but really what I meant was packaging multiple related Web Applications into a single RPM. So, the proper configuration of this Maven build tells the RPM installer that Apache Tomcat is required and installs the webapps to the proper folder within Tomcat.