You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by eyal edri <ey...@gmail.com> on 2010/03/24 14:20:53 UTC

reading dependency list from pom into rpm plugin require

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

Re: reading dependency list from pom into rpm plugin require

Posted by Karl Heinz Marbaise <ka...@soebes.de>.
Hi,


Stephen Connolly-2 wrote:
> 
> I think you really want an rpm packaging type then the listed deps which
> are
> type>rpm</type would be the ones which are required
> 
> not sure if the plugin supports the above
> 

Based on the docs etc. 
http://mojo.codehaus.org/rpm-maven-plugin/adv-params.html#Dependency

it does not....but it would very handy to have that....cause i really could
use it as well..

Kind regards
Karl Heinz Marbaise
-- 
View this message in context: http://old.nabble.com/reading-dependency-list-from-pom-into-rpm-plugin-require-tp28014957p28015307.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: reading dependency list from pom into rpm plugin require

Posted by Stephen Connolly <st...@gmail.com>.
having requires in a rpm on an artifact which is not also an rpm will give
you a requires that can never be satisfied.

therefore you would need to have dependencies with <type>rpm</type> in order
to patch the rpm plugin to scan the dependencies for deps to add as a
requires.

That would not mandate having the packaging set to rpm (but life would be
easier if you did... you'd need two modules for every jar if you insist on
installing each individual jar as an individual rpm)

I am thinking more of the case where an rpm contains many jars that make up
an application... in which case a <packaging>rpm</packaging> makes more
sense

-Stephen

On 24 March 2010 13:51, eyal edri <ey...@gmail.com> wrote:

> you mean that the pom packaging will be set to rpm?
>
> but then, the development env (not deploy) won't work i think..
> cause the maven dependencies will look for the jar in the repository.
>
> that way i create a jar which is deployed to the repository (for normal dev
> env)  and also an rpm which is used for deployment on production.
>
> i didn't understood your last sentence...
>
> > deps which are type>rpm</type would be the ones which are required
>
>
>  do you mean to say there is a way for the rpm plugin to auto know it's
> dependencies, if they are rpm type?
>
> On Wed, Mar 24, 2010 at 3:39 PM, Stephen Connolly <
> stephen.alan.connolly@gmail.com> wrote:
>
> > I think you really want an rpm packaging type then the listed deps which
> > are
> > type>rpm</type would be the ones which are required
> >
> > not sure if the plugin supports the above
> >
> > On 24 March 2010 13:20, eyal edri <ey...@gmail.com> wrote:
> >
> > > 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
> > >
> >
>
>
>
> --
> Eyal Edri
>

Re: reading dependency list from pom into rpm plugin require

Posted by eyal edri <ey...@gmail.com>.
you mean that the pom packaging will be set to rpm?

but then, the development env (not deploy) won't work i think..
cause the maven dependencies will look for the jar in the repository.

that way i create a jar which is deployed to the repository (for normal dev
env)  and also an rpm which is used for deployment on production.

i didn't understood your last sentence...

> deps which are type>rpm</type would be the ones which are required


 do you mean to say there is a way for the rpm plugin to auto know it's
dependencies, if they are rpm type?

On Wed, Mar 24, 2010 at 3:39 PM, Stephen Connolly <
stephen.alan.connolly@gmail.com> wrote:

> I think you really want an rpm packaging type then the listed deps which
> are
> type>rpm</type would be the ones which are required
>
> not sure if the plugin supports the above
>
> On 24 March 2010 13:20, eyal edri <ey...@gmail.com> wrote:
>
> > 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
> >
>



-- 
Eyal Edri

Re: reading dependency list from pom into rpm plugin require

Posted by Stephen Connolly <st...@gmail.com>.
I think you really want an rpm packaging type then the listed deps which are
type>rpm</type would be the ones which are required

not sure if the plugin supports the above

On 24 March 2010 13:20, eyal edri <ey...@gmail.com> wrote:

> 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
>