Example configuration – Primary artifact

This is an example configuration showing how to use the plugin to create an RPM as the primary project artifact

<?xml version="1.0" encoding="UTF-8"?>
<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>de.dentrassi.maven.rpm.test</groupId>
  <artifactId>emptyTest1</artifactId> <!-- used as package name -->
  <version>1.0.0-SNAPSHOT</version> <!-- used as version -->
  <packaging>rpm</packaging> <!-- Primary Artifact Configuration -->

  <name>Test Package #2 -- Primary</name> <!-- used for "summary" field -->
  
  <!-- used for "description" field -->
  <description>
  This is some long long text about foo bar and all the rest.
  </description>

  <url>http://dentrassi.de</url> <!-- used for URL field -->

  <!--
  Packager: Jens Reimann <http:/dentrassi.de>
  Vendor: Jens Reimann
  -->
  <organization>
    <name>Jens Reimann</name>
    <url>http://dentrassi.de</url>
  </organization>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <!-- For managing PGP Signing of RPM -->
    <rpm.skipSigning>true</rpm.skipSigning> <!-- Primary Artifact Configuration(s) -->
  </properties>

  <build>

    <plugins>
      <plugin>
        <groupId>de.dentrassi.maven</groupId>
        <artifactId>rpm</artifactId>
        <version>1.11.0</version>
        <!-- Tell MVN that the plugin has a packaging option -->
        <extensions>true</extensions> <!-- Primary Artifact Configuration -->
        <executions>
          <execution>
          
            <goals>
              <goal>rpm</goal>
            </goals>
            
            <configuration>
              <attach>false</attach> <!-- don't attach RPM as a secondary artifact -->
              <group>Application/Misc</group> <!-- set RPM group -->

              <!-- rule sets -->

              <rulesets>
                <ruleset>
                  <id>my-default</id>
                  <rules>
                    <rule>
                      <when>
                        <type>directory</type>
                      </when>
                      <mode>0750</mode>
                    </rule>
                    <rule>
                      <when>
                        <prefix>/etc/</prefix>
                      </when>
                      <configuration>true</configuration>
                    </rule>
                    <file>
                      <when>
                        <prefix>/usr/shar/doc/</prefix>
                      </when>
                      <documentation>true</documentation>
                    </file>
                    <file>
                      <when>
                        <suffix>README.txt</suffix>
                      </when>
                      <readme>true</readme>
                    </file>
                    <rule>
                      <when>
                        <type>file</type>
                        <prefix>/usr/lib/foobar/lib/dir1</prefix>
                      </when>
                      <user>foo</user>
                      <group>bar</group>
                    </rule>
                  </rules>
                </ruleset>
              </rulesets>

              <entries>
                
                <!-- add explicit directory -->
                
                <entry>
                  <name>/etc/foo</name>
                  <directory>true</directory>
                  <user>root</user>
                  <group>root</group>
                  <mode>0755</mode>
                  
                  <!-- will use the default ruleset -->
                  
                </entry>
                
                <!-- add single file -->
                
                <entry>
                  <name>/etc/foo/bar.txt</name>
                  <file>src/main/resources/bar.txt</file>
                  <user>root</user>
                  <group>root</group>
                  <mode>0600</mode>
                  <ruleset>my-default</ruleset>
                </entry>
                
                <!-- collect all files from : target/classes -->
                
                <entry>
                  <name>/usr/lib/foobar</name>
                  <collect>
                    <from>target/classes</from>
                  </collect>
                  <ruleset>my-default</ruleset>
                </entry>
                
                <!-- collect all files from : src/main/resources/etc -->
                
                <entry>
                  <name>/etc</name>
                  <collect>
                    <from>src/main/resources/etc</from>
                    <directories>false</directories> <!-- make implicit directories -->
                  </collect>
                  <ruleset>my-default</ruleset>
                </entry>
                
                <!-- collect all files from : src/main/resources/lib -->
                
                <entry>
                  <name>/usr/lib</name>
                  <collect>
                    <from>src/main/resources/lib</from>
                    <directories>true</directories> <!-- make explicit directories -->
                  </collect>
                  <ruleset>my-default</ruleset>
                </entry>
                
              </entries>
              
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>