Hi,

i'm looking for the best way to auto fill the <require> field in the rpm
plugin.
since we're using rpm/yum as the deployer of our java apps,
i don't want to mange a duplicate set of dependencies in the pom file,
in order to do so,  i want to fill the <requires> tag auto from the maven
dependencies list in the pom file.

for example, the following pom will create an rpm with rpm dependencies
similar to the maven ones.
(marked in yellow)

a few 'rules' needs to be followed:
1. each rpm will always have the same name of the artifactId.
2. each maven dependency will be packed in its own rpm

any ideas? (gmaven maybe..)

*the pom:*
<?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>com.company.url.miscats</groupId>
  <artifactId>Application</artifactId>
  <packaging>jar</packaging>
  <version>2.0.0-3</version>
  <name>Application</name>
  <parent>
   <artifactId>Parent</artifactId>
   <groupId>com.company.maven.pom</groupId>
   <version>2.0.0-5</version>
  </parent>
  <description>the app</description>
  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>rpm-maven-plugin</artifactId>
        <extensions>false</extensions>
     <executions>
          <execution>
            <goals>
              <goal>rpm</goal>
            </goals>
          </execution>
     </executions>
     <configuration>
    <copyright>${project.organization.name}</copyright>
            <distribution>XXX</distribution>
            <group>Sample/Apps</group>
            <packager>${user.name}</packager>
             <name>${project.name}</name>
             <summary>${project.description}</summary>
             <needarch>true</needarch>
             <autoRequires>true</autoRequires>
             <dependency/>
             <requires>
             <require>Dep1</require>
             <require>Dep2</require>
             </requires>
             <mappings>
             <mapping>
               <artifact/>

<directory>/usr/lib/java/${project.artifactId}</directory>
                       <filemode>750</filemode>
                       <username>root</username>
                       <groupname>root</groupname>
                    </mapping>
                    <mapping>
                       <directory>/etc/${project.artifactId}</directory>
                       <filemode>750</filemode>
                       <username>root</username>
                       <groupname>root</groupname>
                       <sources>
                       <source>

<location>src/main/resources/App.properties</location>

<location>src/main/resources/log4j.properties</location>
                       </source>
                       </sources>
                    </mapping>
                    <mapping>
                       <directory>/etc/cron.d/</directory>
                       <filemode>750</filemode>
                       <username>root</username>
                       <groupname>root</groupname>
                       <sources>
                       <source>
                       <location>src/main/resources/App.cron</location>
                       </source>
                       </sources>
                    </mapping>
                </mappings>
                <preinstallScriptlet>
                     <script>echo "installing ${artifactId} on arch
${os.arch}"</script>
                </preinstallScriptlet>
     </configuration>
   </plugin>
    </plugins>
  </build>
  <dependencies>
   <dependency>
   <groupId>com.company.sql</groupId>
   <artifactId>Dep1</artifactId>
   <version>2.0.0-4</version>
   </dependency>
   <dependency>
   <groupId>com.company.stub</groupId>
   <artifactId>Dep2</artifactId>
   <version>2.0.0-2</version>
   </dependency>
  </dependencies>
</project>

-- 
Eyal Edri

Reply via email to