Fork me on GitHub

Sample Configuration

Below is a sample project descriptor which utilizes all of the basic parameters and a few of the advanced parameters. Note that the servlet API jar is not packaged in the RPM because it is not a runtime dependency.

<?xml version="1.0" encoding="UTF-8"?>
<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>collection.trash</groupId>
  <artifactId>landfill</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>Land-Based Trash Repository</name>
  <description>This is a sample using trash collection as an example.</description>

  <organization>
    <name>Sanitation Workers of Washington, D.C.</name>
    <url>http://www.trash.gov/</url>
  </organization>

  <dependencies>
    <dependency>
      <groupId>jmock</groupId>
      <artifactId>jmock</artifactId>
      <version>1.0.1</version>
    </dependency>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>servlet-api</artifactId>
      <version>2.4</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>rpm-maven-plugin</artifactId>
        <version>2.3.0</version>
        <executions>
          <execution>
            <id>generate-rpm</id>
            <goals>
              <goal>rpm</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <license>GPL (c) 2005, SWWDC</license>
          <distribution>Trash 2005</distribution>
          <group>Application/Collectors</group>
          <icon>src/main/resources/icon.gif</icon>
          <packager>SWWDC</packager>
          <prefix>/usr/local</prefix>
          <changelogFile>src/changelog</changelogFile>
          <defineStatements>
            <defineStatement>_unpackaged_files_terminate_build 0</defineStatement>
          </defineStatements>
          <mappings>
            <mapping>
              <directory>/usr/local/bin/landfill</directory>
              <filemode>440</filemode>
              <username>dumper</username>
              <groupname>dumpgroup</groupname>
              <sources>
                <source>
                  <location>target/classes</location>
                </source>
              </sources>
            </mapping>
            <mapping>
              <directory>/usr/local/doc/landfill</directory>
              <documentation>true</documentation>
              <filemode>444</filemode>
              <username>dumper</username>
              <groupname>dumpgroup</groupname>
              <sources>
                <source>
                  <location>target/site</location>
                </source>
              </sources>
            </mapping>
            <mapping>
              <directory>/usr/local/lib</directory>
              <filemode>750</filemode>
              <username>dumper</username>
              <groupname>dumpgroup</groupname>
              <dependency>
                <includes>
                  <include>jmock:jmock</include>
                  <include>javax.servlet:servlet-api:2.4</include>
                </includes>
                <excludes>
                  <exclude>junit:junit</exclude>
                </excludes>
              </dependency>
            </mapping>
            <mapping>
              <directory>/usr/local/bin</directory>
              <filemode>750</filemode>
              <username>dumper</username>
              <groupname>dumpgroup</groupname>
              <sources>
                <source>
                  <location>src/main/bin</location>
                </source>
                <softlinkSource>
                  <location>/usr/local/bin/new.sh</location>
                  <destination>old.sh</destination>
                </softlinkSource>
              </sources>
            </mapping>
            <mapping>
              <directory>/usr/local/oldbin</directory>
              <filemode>750</filemode>
              <username>dumper</username>
              <groupname>dumpgroup</groupname>
              <sources>
                <softlinkSource>
                  <location>/usr/local/bin</location>
                </softlinkSource>
              </sources>
            </mapping>
            <mapping>
              <directory>/usr/local/conf/landfill</directory>
              <configuration>true</configuration>
              <filemode>640</filemode>
              <username>dumper</username>
              <groupname>dumpgroup</groupname>
              <sources>
                <source>
                  <location>src/main/conf</location>
                </source>
              </sources>
            </mapping>
            <mapping>
              <directory>/usr/local/log/landfill</directory>
              <filemode>750</filemode>
              <username>dumper</username>
              <groupname>dumpgroup</groupname>
            </mapping>
          </mappings>
          <preinstallScriptlet>
            <script>echo "installing ${project.name} now"</script>
          </preinstallScriptlet>
          <postinstallScriptlet>
            <scriptFile>src/main/scripts/postinstall</scriptFile>
            <fileEncoding>utf-8</fileEncoding>
            <filter>true</filter>
          </postinstallScriptlet>
          <preremoveScriptlet>
            <scriptFile>src/main/scripts/preremove</scriptFile>
            <fileEncoding>utf-8</fileEncoding>
          </preremoveScriptlet>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>