You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Reto Bachmann-Gmür <re...@gmuer.ch> on 2008/02/21 21:47:44 UTC

assembly plugin and project inheritance

Hello

I'm having many projects that share some dependencies and that should be 
packaged the same way. So I wanted to have a parent project configuring 
the maven-assembly-plugin.

I did this with the following  in the parent pom:

....
<plugin>
	<artifactId>maven-assembly-plugin</artifactId>
	<configuration>
		<descriptors>
			<descriptor>../rwcf-apps/src/assembly/dist.xml</descriptor>
		</descriptors>
	</configuration>


This only works when the parent is checked out in a sibling directory of 
the child. If one just check out a child project without checking out 
the parent assembly:assembly wont work. Things work using a 
descriptorRef but the predefined descriptors don't do what I'm looking for.

Possibly ways to solve the issues might be:

    * have the plugin look up the descriptor from the parent rather
    * reference a descriptor with an http uri
    * include the content of descriptor directly in the pom

...but I didn't find a way to do it in any of these ways.

Any suggestion on how to make it possible to check out a single 
child-project and being able to assemble it?

If you would like to know more precisely what I'm doing, you may look at

    * The descriptor:
      https://knobot.svn.sourceforge.net/svnroot/knobot/rwcf-apps/trunk/src/assembly/dist.xml
    * The parent pom:
      https://knobot.svn.sourceforge.net/svnroot/knobot/rwcf-apps/trunk/pom.xml
    * A child pom:
      https://knobot.svn.sourceforge.net/svnroot/knobot/rwcf-app-webdav/trunk/pom.xml

Cheers,
reto


Re: assembly plugin and project inheritance

Posted by Stephen Connolly <st...@gmail.com>.
If you do something like

           <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-dependency-plugin</artifactId>
               <configuration>
                   *<includeTypes>assembly-descriptor**<****includeTypes>*
                   ...**
               </configuration>
               <goals>
                   <goal>copy-dependencies</goal>
               </goals>
           </plugin>

That will only copy the assembly-descriptor dependencies of your module


On Sun, Feb 24, 2008 at 9:09 PM, Stephen Connolly <
stephen.alan.connolly@gmail.com> wrote:

> Copy requires that the artifact must be in the local repository or in a
> remote repository.
>
> The copy dependencies allows for the artifact to come from the reactor, so
> you don't have to install the artifact into your local repository.
>
> The copy dependencies can be set to only copy one dependency.
>
> Trust me, this is the better way to do it.
>
> -Stephen
>
>
> On Sat, Feb 23, 2008 at 9:38 PM, Reto Bachmann-Gmür <re...@gmuer.ch> wrote:
>
> > Thank you very much for your help, I can now have many projects generate
> > the right assembly with just one assembly descriptor and without
> > requiring to check out multiple projects (and having them at the right
> > position in the directory structure).
> >
> > I don't understand your suggestion to use copy-dependencies, what I'm
> > doing is copying a single resource (the assembly descriptor) and not all
> > of the dependencies. The copy goal seems to do its job.
> >
> > Cheers,
> > reto
> >
> >
> >
> > Stephen Connolly wrote:
> > > there are two sets of goals in the maven dependency plugin.
> > >
> > > the first set are copy and unpack. you specify the artifacts inside
> > > the plugin configuration. these are not the set you want. the set you
> > > want are copy-dependencies (or something like that I am on my iPod so
> > > you will have to check) with this set you add the dependency to the
> > > pom. that will force maven to sequence things correctly for you.
> > >
> > > the build helper plugin has a default phase, so leave that alone. I
> > > would bind the dependency plugin to one of the generate phases
> > > (sources or resources)
> > >
> > > Stephen
> > >  2/22/08, Reto Bachmann-Gmür <re...@gmuer.ch> wrote:
> > >
> > >> The version I posted doesn't work as the child-projects can't perform
> > >> the attach-artifact attached to the package phase.
> > >>
> > >> I've now extracted the dist configuration and the attachment of it to
> > a
> > >> separate project[1]. Having done this I also attached the copy and
> > the
> > >> assembly goals to the compile and package phases [2].
> > >>
> > >>
> > >> 1.
> > >>
> > http://knobot.svn.sourceforge.net/svnroot/knobot/rwcf-apps-assembly/trunk/pom.xml
> > >> 2. in
> > >>
> > http://knobot.svn.sourceforge.net/svnroot/knobot/rwcf-apps/trunk/pom.xml
> > >>
> > >>
> > >> Reto Bachmann-Gmür wrote:
> > >>
> > >>> Thanks Stephen,
> > >>>
> > >>> trying to follow the path you describe I added the following to the
> > >>> parent-pom:
> > >>>
> > >>> <plugin>
> > >>> <groupId>org.codehaus.mojo</groupId>
> > >>> <artifactId>build-helper-maven-plugin</artifactId>
> > >>> <executions>
> > >>> <execution>
> > >>> <id>attach-artifacts</id>
> > >>> <phase>package</phase>
> > >>> <goals>
> > >>> <goal>attach-artifact</goal>
> > >>> </goals>
> > >>> <configuration>
> > >>> <artifacts>
> > >>> <artifact>
> > >>> <file>src/assembly/dist.xml</file>
> > >>> <type>xml</type>
> > >>> <classifier>
> > >>> assembly-descriptor
> > >>> </classifier>
> > >>> </artifact>
> > >>> </artifacts>
> > >>> </configuration>
> > >>> </execution>
> > >>> </executions>
> > >>> </plugin>
> > >>>
> > >>> and
> > >>> <plugin>
> > >>> <groupId>org.apache.maven.plugins</groupId>
> > >>> <artifactId>maven-dependency-plugin</artifactId>
> > >>> <configuration>
> > >>> <artifactItems>
> > >>> <artifactItem>
> > >>> <groupId>org.wymiwyg.rwcf</groupId>
> > >>> <artifactId>rwcf-apps</artifactId>
> > >>> <version>0.0.1</version>
> > >>> <type>xml</type>
> > >>> <classifier>assembly-descriptor</classifier>
> > >>> <overWrite>false</overWrite>
> > >>> <outputDirectory>
> > >>> ${project.build.directory}/src/assembly/
> > >>> </outputDirectory>
> > >>> <destFileName>dist.xml</destFileName>
> > >>> </artifactItem>
> > >>> </artifactItems>
> > >>> </configuration>
> > >>> </plugin>
> > >>>
> > >>> furthermore I changed the descriptor of maven-assembly-plugin to use
> > >>> ${project.build.directory}/src/assembly/dist.xml. I didn't change
> > >>> anything to the child-projects.
> > >>>
> > >>> I can now execute "mvn clean dependency:copy assembly:assembly" for
> > >>> child projects to create a distribution-package.
> > >>>
> > >>> The only thing which I'm still insecure is about attaching this to
> > >>> phases, the difficulty seems that the super project doesn't need to
> > >>> have this attached to any phase, and the dependency resolution fails
> > >>> unless executed after install (a solution might be to split the
> > parent
> > >>> into a grand-parent providing the assembly descriptor and binding it
> > >>> to phases in the intermediate parent). But I'm not sure anyway in
> > >>> which phase to best create zip and tar.
> > >>>
> > >>> Cheers,
> > >>> reto
> > >>>
> > >>> Stephen Connolly wrote:
> > >>>
> > >>>> You could attach the common descriptor as a build artifact one
> > >>>> module, and
> > >>>> then use the dependency plugin to pull it down to each child
> > module.
> > >>>>
> > >>>> i.e.
> > >>>>
> > >>>> Use buildhelper-maven-plugin in rwcf-apps to attach dist.xml with a
> > >>>> classifier of, e.g. assembly-descriptor.
> > >>>> Now when you run mvn install or mvn deploy on rwcf-apps the
> > >>>> descriptor will
> > >>>> be published to the maven repository (local or remote respectively)
> > >>>>
> > >>>> Then in one of the modules that you want to use this common
> > >>>> descriptor, add
> > >>>> a dependency on the rwcf-apps with a type of assembly-descriptor,
> > you
> > >>>> use
> > >>>> maven-dependency-plugin to copy the dependency to your target
> > >>>> directory, and
> > >>>> then your pom just directs the assembly plugin to use that
> > descriptor.
> > >>>>
> > >>>> -Stephen
> > >>>>
> > >>>> On Thu, Feb 21, 2008 at 8:47 PM, Reto Bachmann-Gmür <re...@gmuer.ch>
> > >>>> wrote:
> > >>>>
> > >>>>
> > >>>>
> > >>>>> Hello
> > >>>>>
> > >>>>> I'm having many projects that share some dependencies and that
> > >>>>> should be
> > >>>>> packaged the same way. So I wanted to have a parent project
> > configuring
> > >>>>> the maven-assembly-plugin.
> > >>>>>
> > >>>>> I did this with the following in the parent pom:
> > >>>>>
> > >>>>> ....
> > >>>>> <plugin>
> > >>>>> <artifactId>maven-assembly-plugin</artifactId>
> > >>>>> <configuration>
> > >>>>> <descriptors>
> > >>>>>
> > >>>>> <descriptor>../rwcf-apps/src/assembly/dist.xml</descriptor>
> > >>>>> </descriptors>
> > >>>>> </configuration>
> > >>>>>
> > >>>>>
> > >>>>> This only works when the parent is checked out in a sibling
> > >>>>> directory of
> > >>>>> the child. If one just check out a child project without checking
> > out
> > >>>>> the parent assembly:assembly wont work. Things work using a
> > >>>>> descriptorRef but the predefined descriptors don't do what I'm
> > looking
> > >>>>> for.
> > >>>>>
> > >>>>> Possibly ways to solve the issues might be:
> > >>>>>
> > >>>>> * have the plugin look up the descriptor from the parent rather
> > >>>>> * reference a descriptor with an http uri
> > >>>>> * include the content of descriptor directly in the pom
> > >>>>>
> > >>>>> ...but I didn't find a way to do it in any of these ways.
> > >>>>>
> > >>>>> Any suggestion on how to make it possible to check out a single
> > >>>>> child-project and being able to assemble it?
> > >>>>>
> > >>>>> If you would like to know more precisely what I'm doing, you may
> > >>>>> look at
> > >>>>>
> > >>>>> * The descriptor:
> > >>>>>
> > >>>>>
> > >>>>>
> > >>
> > https://knobot.svn.sourceforge.net/svnroot/knobot/rwcf-apps/trunk/src/assembly/dist.xml
> > >>
> > >>>>> * The parent pom:
> > >>>>>
> > >>>>>
> > >>>>>
> > >>
> > https://knobot.svn.sourceforge.net/svnroot/knobot/rwcf-apps/trunk/pom.xml
> > >>
> > >>>>> * A child pom:
> > >>>>>
> > >>>>>
> > >>>>>
> > >>
> > https://knobot.svn.sourceforge.net/svnroot/knobot/rwcf-app-webdav/trunk/pom.xml
> > >>
> > >>>>> Cheers,
> > >>>>> reto
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>
> > >>>
> > >>
> > >>
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> >
> >
> >
>

RE: assembly plugin and project inheritance

Posted by "Brian E. Fox" <br...@reply.infinity.nu>.
Stephen is correct. The other subtle difference is that using the xxx-dependencies forces you to declare a dependency and then maven can reorder reactor builds appropriately. There is currently no way for the dependency plugin to interact with the reactor order in 2.0.

-----Original Message-----
From: Stephen Connolly [mailto:stephen.alan.connolly@gmail.com] 
Sent: Sunday, February 24, 2008 4:09 PM
To: Maven Users List
Subject: Re: assembly plugin and project inheritance

Copy requires that the artifact must be in the local repository or in a
remote repository.

The copy dependencies allows for the artifact to come from the reactor, so
you don't have to install the artifact into your local repository.

The copy dependencies can be set to only copy one dependency.

Trust me, this is the better way to do it.

-Stephen

On Sat, Feb 23, 2008 at 9:38 PM, Reto Bachmann-Gmür <re...@gmuer.ch> wrote:

> Thank you very much for your help, I can now have many projects generate
> the right assembly with just one assembly descriptor and without
> requiring to check out multiple projects (and having them at the right
> position in the directory structure).
>
> I don't understand your suggestion to use copy-dependencies, what I'm
> doing is copying a single resource (the assembly descriptor) and not all
> of the dependencies. The copy goal seems to do its job.
>
> Cheers,
> reto
>
>
>
> Stephen Connolly wrote:
> > there are two sets of goals in the maven dependency plugin.
> >
> > the first set are copy and unpack. you specify the artifacts inside
> > the plugin configuration. these are not the set you want. the set you
> > want are copy-dependencies (or something like that I am on my iPod so
> > you will have to check) with this set you add the dependency to the
> > pom. that will force maven to sequence things correctly for you.
> >
> > the build helper plugin has a default phase, so leave that alone. I
> > would bind the dependency plugin to one of the generate phases
> > (sources or resources)
> >
> > Stephen
> >  2/22/08, Reto Bachmann-Gmür <re...@gmuer.ch> wrote:
> >
> >> The version I posted doesn't work as the child-projects can't perform
> >> the attach-artifact attached to the package phase.
> >>
> >> I've now extracted the dist configuration and the attachment of it to a
> >> separate project[1]. Having done this I also attached the copy and the
> >> assembly goals to the compile and package phases [2].
> >>
> >>
> >> 1.
> >>
> http://knobot.svn.sourceforge.net/svnroot/knobot/rwcf-apps-assembly/trunk/pom.xml
> >> 2. in
> >>
> http://knobot.svn.sourceforge.net/svnroot/knobot/rwcf-apps/trunk/pom.xml
> >>
> >>
> >> Reto Bachmann-Gmür wrote:
> >>
> >>> Thanks Stephen,
> >>>
> >>> trying to follow the path you describe I added the following to the
> >>> parent-pom:
> >>>
> >>> <plugin>
> >>> <groupId>org.codehaus.mojo</groupId>
> >>> <artifactId>build-helper-maven-plugin</artifactId>
> >>> <executions>
> >>> <execution>
> >>> <id>attach-artifacts</id>
> >>> <phase>package</phase>
> >>> <goals>
> >>> <goal>attach-artifact</goal>
> >>> </goals>
> >>> <configuration>
> >>> <artifacts>
> >>> <artifact>
> >>> <file>src/assembly/dist.xml</file>
> >>> <type>xml</type>
> >>> <classifier>
> >>> assembly-descriptor
> >>> </classifier>
> >>> </artifact>
> >>> </artifacts>
> >>> </configuration>
> >>> </execution>
> >>> </executions>
> >>> </plugin>
> >>>
> >>> and
> >>> <plugin>
> >>> <groupId>org.apache.maven.plugins</groupId>
> >>> <artifactId>maven-dependency-plugin</artifactId>
> >>> <configuration>
> >>> <artifactItems>
> >>> <artifactItem>
> >>> <groupId>org.wymiwyg.rwcf</groupId>
> >>> <artifactId>rwcf-apps</artifactId>
> >>> <version>0.0.1</version>
> >>> <type>xml</type>
> >>> <classifier>assembly-descriptor</classifier>
> >>> <overWrite>false</overWrite>
> >>> <outputDirectory>
> >>> ${project.build.directory}/src/assembly/
> >>> </outputDirectory>
> >>> <destFileName>dist.xml</destFileName>
> >>> </artifactItem>
> >>> </artifactItems>
> >>> </configuration>
> >>> </plugin>
> >>>
> >>> furthermore I changed the descriptor of maven-assembly-plugin to use
> >>> ${project.build.directory}/src/assembly/dist.xml. I didn't change
> >>> anything to the child-projects.
> >>>
> >>> I can now execute "mvn clean dependency:copy assembly:assembly" for
> >>> child projects to create a distribution-package.
> >>>
> >>> The only thing which I'm still insecure is about attaching this to
> >>> phases, the difficulty seems that the super project doesn't need to
> >>> have this attached to any phase, and the dependency resolution fails
> >>> unless executed after install (a solution might be to split the parent
> >>> into a grand-parent providing the assembly descriptor and binding it
> >>> to phases in the intermediate parent). But I'm not sure anyway in
> >>> which phase to best create zip and tar.
> >>>
> >>> Cheers,
> >>> reto
> >>>
> >>> Stephen Connolly wrote:
> >>>
> >>>> You could attach the common descriptor as a build artifact one
> >>>> module, and
> >>>> then use the dependency plugin to pull it down to each child module.
> >>>>
> >>>> i.e.
> >>>>
> >>>> Use buildhelper-maven-plugin in rwcf-apps to attach dist.xml with a
> >>>> classifier of, e.g. assembly-descriptor.
> >>>> Now when you run mvn install or mvn deploy on rwcf-apps the
> >>>> descriptor will
> >>>> be published to the maven repository (local or remote respectively)
> >>>>
> >>>> Then in one of the modules that you want to use this common
> >>>> descriptor, add
> >>>> a dependency on the rwcf-apps with a type of assembly-descriptor, you
> >>>> use
> >>>> maven-dependency-plugin to copy the dependency to your target
> >>>> directory, and
> >>>> then your pom just directs the assembly plugin to use that
> descriptor.
> >>>>
> >>>> -Stephen
> >>>>
> >>>> On Thu, Feb 21, 2008 at 8:47 PM, Reto Bachmann-Gmür <re...@gmuer.ch>
> >>>> wrote:
> >>>>
> >>>>
> >>>>
> >>>>> Hello
> >>>>>
> >>>>> I'm having many projects that share some dependencies and that
> >>>>> should be
> >>>>> packaged the same way. So I wanted to have a parent project
> configuring
> >>>>> the maven-assembly-plugin.
> >>>>>
> >>>>> I did this with the following in the parent pom:
> >>>>>
> >>>>> ....
> >>>>> <plugin>
> >>>>> <artifactId>maven-assembly-plugin</artifactId>
> >>>>> <configuration>
> >>>>> <descriptors>
> >>>>>
> >>>>> <descriptor>../rwcf-apps/src/assembly/dist.xml</descriptor>
> >>>>> </descriptors>
> >>>>> </configuration>
> >>>>>
> >>>>>
> >>>>> This only works when the parent is checked out in a sibling
> >>>>> directory of
> >>>>> the child. If one just check out a child project without checking
> out
> >>>>> the parent assembly:assembly wont work. Things work using a
> >>>>> descriptorRef but the predefined descriptors don't do what I'm
> looking
> >>>>> for.
> >>>>>
> >>>>> Possibly ways to solve the issues might be:
> >>>>>
> >>>>> * have the plugin look up the descriptor from the parent rather
> >>>>> * reference a descriptor with an http uri
> >>>>> * include the content of descriptor directly in the pom
> >>>>>
> >>>>> ...but I didn't find a way to do it in any of these ways.
> >>>>>
> >>>>> Any suggestion on how to make it possible to check out a single
> >>>>> child-project and being able to assemble it?
> >>>>>
> >>>>> If you would like to know more precisely what I'm doing, you may
> >>>>> look at
> >>>>>
> >>>>> * The descriptor:
> >>>>>
> >>>>>
> >>>>>
> >>
> https://knobot.svn.sourceforge.net/svnroot/knobot/rwcf-apps/trunk/src/assembly/dist.xml
> >>
> >>>>> * The parent pom:
> >>>>>
> >>>>>
> >>>>>
> >>
> https://knobot.svn.sourceforge.net/svnroot/knobot/rwcf-apps/trunk/pom.xml
> >>
> >>>>> * A child pom:
> >>>>>
> >>>>>
> >>>>>
> >>
> https://knobot.svn.sourceforge.net/svnroot/knobot/rwcf-app-webdav/trunk/pom.xml
> >>
> >>>>> Cheers,
> >>>>> reto
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>
> >>>
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>
>
>

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


Re: assembly plugin and project inheritance

Posted by Stephen Connolly <st...@gmail.com>.
Copy requires that the artifact must be in the local repository or in a
remote repository.

The copy dependencies allows for the artifact to come from the reactor, so
you don't have to install the artifact into your local repository.

The copy dependencies can be set to only copy one dependency.

Trust me, this is the better way to do it.

-Stephen

On Sat, Feb 23, 2008 at 9:38 PM, Reto Bachmann-Gmür <re...@gmuer.ch> wrote:

> Thank you very much for your help, I can now have many projects generate
> the right assembly with just one assembly descriptor and without
> requiring to check out multiple projects (and having them at the right
> position in the directory structure).
>
> I don't understand your suggestion to use copy-dependencies, what I'm
> doing is copying a single resource (the assembly descriptor) and not all
> of the dependencies. The copy goal seems to do its job.
>
> Cheers,
> reto
>
>
>
> Stephen Connolly wrote:
> > there are two sets of goals in the maven dependency plugin.
> >
> > the first set are copy and unpack. you specify the artifacts inside
> > the plugin configuration. these are not the set you want. the set you
> > want are copy-dependencies (or something like that I am on my iPod so
> > you will have to check) with this set you add the dependency to the
> > pom. that will force maven to sequence things correctly for you.
> >
> > the build helper plugin has a default phase, so leave that alone. I
> > would bind the dependency plugin to one of the generate phases
> > (sources or resources)
> >
> > Stephen
> >  2/22/08, Reto Bachmann-Gmür <re...@gmuer.ch> wrote:
> >
> >> The version I posted doesn't work as the child-projects can't perform
> >> the attach-artifact attached to the package phase.
> >>
> >> I've now extracted the dist configuration and the attachment of it to a
> >> separate project[1]. Having done this I also attached the copy and the
> >> assembly goals to the compile and package phases [2].
> >>
> >>
> >> 1.
> >>
> http://knobot.svn.sourceforge.net/svnroot/knobot/rwcf-apps-assembly/trunk/pom.xml
> >> 2. in
> >>
> http://knobot.svn.sourceforge.net/svnroot/knobot/rwcf-apps/trunk/pom.xml
> >>
> >>
> >> Reto Bachmann-Gmür wrote:
> >>
> >>> Thanks Stephen,
> >>>
> >>> trying to follow the path you describe I added the following to the
> >>> parent-pom:
> >>>
> >>> <plugin>
> >>> <groupId>org.codehaus.mojo</groupId>
> >>> <artifactId>build-helper-maven-plugin</artifactId>
> >>> <executions>
> >>> <execution>
> >>> <id>attach-artifacts</id>
> >>> <phase>package</phase>
> >>> <goals>
> >>> <goal>attach-artifact</goal>
> >>> </goals>
> >>> <configuration>
> >>> <artifacts>
> >>> <artifact>
> >>> <file>src/assembly/dist.xml</file>
> >>> <type>xml</type>
> >>> <classifier>
> >>> assembly-descriptor
> >>> </classifier>
> >>> </artifact>
> >>> </artifacts>
> >>> </configuration>
> >>> </execution>
> >>> </executions>
> >>> </plugin>
> >>>
> >>> and
> >>> <plugin>
> >>> <groupId>org.apache.maven.plugins</groupId>
> >>> <artifactId>maven-dependency-plugin</artifactId>
> >>> <configuration>
> >>> <artifactItems>
> >>> <artifactItem>
> >>> <groupId>org.wymiwyg.rwcf</groupId>
> >>> <artifactId>rwcf-apps</artifactId>
> >>> <version>0.0.1</version>
> >>> <type>xml</type>
> >>> <classifier>assembly-descriptor</classifier>
> >>> <overWrite>false</overWrite>
> >>> <outputDirectory>
> >>> ${project.build.directory}/src/assembly/
> >>> </outputDirectory>
> >>> <destFileName>dist.xml</destFileName>
> >>> </artifactItem>
> >>> </artifactItems>
> >>> </configuration>
> >>> </plugin>
> >>>
> >>> furthermore I changed the descriptor of maven-assembly-plugin to use
> >>> ${project.build.directory}/src/assembly/dist.xml. I didn't change
> >>> anything to the child-projects.
> >>>
> >>> I can now execute "mvn clean dependency:copy assembly:assembly" for
> >>> child projects to create a distribution-package.
> >>>
> >>> The only thing which I'm still insecure is about attaching this to
> >>> phases, the difficulty seems that the super project doesn't need to
> >>> have this attached to any phase, and the dependency resolution fails
> >>> unless executed after install (a solution might be to split the parent
> >>> into a grand-parent providing the assembly descriptor and binding it
> >>> to phases in the intermediate parent). But I'm not sure anyway in
> >>> which phase to best create zip and tar.
> >>>
> >>> Cheers,
> >>> reto
> >>>
> >>> Stephen Connolly wrote:
> >>>
> >>>> You could attach the common descriptor as a build artifact one
> >>>> module, and
> >>>> then use the dependency plugin to pull it down to each child module.
> >>>>
> >>>> i.e.
> >>>>
> >>>> Use buildhelper-maven-plugin in rwcf-apps to attach dist.xml with a
> >>>> classifier of, e.g. assembly-descriptor.
> >>>> Now when you run mvn install or mvn deploy on rwcf-apps the
> >>>> descriptor will
> >>>> be published to the maven repository (local or remote respectively)
> >>>>
> >>>> Then in one of the modules that you want to use this common
> >>>> descriptor, add
> >>>> a dependency on the rwcf-apps with a type of assembly-descriptor, you
> >>>> use
> >>>> maven-dependency-plugin to copy the dependency to your target
> >>>> directory, and
> >>>> then your pom just directs the assembly plugin to use that
> descriptor.
> >>>>
> >>>> -Stephen
> >>>>
> >>>> On Thu, Feb 21, 2008 at 8:47 PM, Reto Bachmann-Gmür <re...@gmuer.ch>
> >>>> wrote:
> >>>>
> >>>>
> >>>>
> >>>>> Hello
> >>>>>
> >>>>> I'm having many projects that share some dependencies and that
> >>>>> should be
> >>>>> packaged the same way. So I wanted to have a parent project
> configuring
> >>>>> the maven-assembly-plugin.
> >>>>>
> >>>>> I did this with the following in the parent pom:
> >>>>>
> >>>>> ....
> >>>>> <plugin>
> >>>>> <artifactId>maven-assembly-plugin</artifactId>
> >>>>> <configuration>
> >>>>> <descriptors>
> >>>>>
> >>>>> <descriptor>../rwcf-apps/src/assembly/dist.xml</descriptor>
> >>>>> </descriptors>
> >>>>> </configuration>
> >>>>>
> >>>>>
> >>>>> This only works when the parent is checked out in a sibling
> >>>>> directory of
> >>>>> the child. If one just check out a child project without checking
> out
> >>>>> the parent assembly:assembly wont work. Things work using a
> >>>>> descriptorRef but the predefined descriptors don't do what I'm
> looking
> >>>>> for.
> >>>>>
> >>>>> Possibly ways to solve the issues might be:
> >>>>>
> >>>>> * have the plugin look up the descriptor from the parent rather
> >>>>> * reference a descriptor with an http uri
> >>>>> * include the content of descriptor directly in the pom
> >>>>>
> >>>>> ...but I didn't find a way to do it in any of these ways.
> >>>>>
> >>>>> Any suggestion on how to make it possible to check out a single
> >>>>> child-project and being able to assemble it?
> >>>>>
> >>>>> If you would like to know more precisely what I'm doing, you may
> >>>>> look at
> >>>>>
> >>>>> * The descriptor:
> >>>>>
> >>>>>
> >>>>>
> >>
> https://knobot.svn.sourceforge.net/svnroot/knobot/rwcf-apps/trunk/src/assembly/dist.xml
> >>
> >>>>> * The parent pom:
> >>>>>
> >>>>>
> >>>>>
> >>
> https://knobot.svn.sourceforge.net/svnroot/knobot/rwcf-apps/trunk/pom.xml
> >>
> >>>>> * A child pom:
> >>>>>
> >>>>>
> >>>>>
> >>
> https://knobot.svn.sourceforge.net/svnroot/knobot/rwcf-app-webdav/trunk/pom.xml
> >>
> >>>>> Cheers,
> >>>>> reto
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>
> >>>
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>
>
>

Re: assembly plugin and project inheritance

Posted by Reto Bachmann-Gmür <re...@gmuer.ch>.
Thank you very much for your help, I can now have many projects generate 
the right assembly with just one assembly descriptor and without 
requiring to check out multiple projects (and having them at the right 
position in the directory structure).

I don't understand your suggestion to use copy-dependencies, what I'm 
doing is copying a single resource (the assembly descriptor) and not all 
of the dependencies. The copy goal seems to do its job.

Cheers,
reto



Stephen Connolly wrote:
> there are two sets of goals in the maven dependency plugin.
>
> the first set are copy and unpack. you specify the artifacts inside
> the plugin configuration. these are not the set you want. the set you
> want are copy-dependencies (or something like that I am on my iPod so
> you will have to check) with this set you add the dependency to the
> pom. that will force maven to sequence things correctly for you.
>
> the build helper plugin has a default phase, so leave that alone. I
> would bind the dependency plugin to one of the generate phases
> (sources or resources)
>
> Stephen
>  2/22/08, Reto Bachmann-Gmür <re...@gmuer.ch> wrote:
>   
>> The version I posted doesn't work as the child-projects can't perform
>> the attach-artifact attached to the package phase.
>>
>> I've now extracted the dist configuration and the attachment of it to a
>> separate project[1]. Having done this I also attached the copy and the
>> assembly goals to the compile and package phases [2].
>>
>>
>> 1.
>> http://knobot.svn.sourceforge.net/svnroot/knobot/rwcf-apps-assembly/trunk/pom.xml
>> 2. in
>> http://knobot.svn.sourceforge.net/svnroot/knobot/rwcf-apps/trunk/pom.xml
>>
>>
>> Reto Bachmann-Gmür wrote:
>>     
>>> Thanks Stephen,
>>>
>>> trying to follow the path you describe I added the following to the
>>> parent-pom:
>>>
>>> <plugin>
>>> <groupId>org.codehaus.mojo</groupId>
>>> <artifactId>build-helper-maven-plugin</artifactId>
>>> <executions>
>>> <execution>
>>> <id>attach-artifacts</id>
>>> <phase>package</phase>
>>> <goals>
>>> <goal>attach-artifact</goal>
>>> </goals>
>>> <configuration>
>>> <artifacts>
>>> <artifact>
>>> <file>src/assembly/dist.xml</file>
>>> <type>xml</type>
>>> <classifier>
>>> assembly-descriptor
>>> </classifier>
>>> </artifact>
>>> </artifacts>
>>> </configuration>
>>> </execution>
>>> </executions>
>>> </plugin>
>>>
>>> and
>>> <plugin>
>>> <groupId>org.apache.maven.plugins</groupId>
>>> <artifactId>maven-dependency-plugin</artifactId>
>>> <configuration>
>>> <artifactItems>
>>> <artifactItem>
>>> <groupId>org.wymiwyg.rwcf</groupId>
>>> <artifactId>rwcf-apps</artifactId>
>>> <version>0.0.1</version>
>>> <type>xml</type>
>>> <classifier>assembly-descriptor</classifier>
>>> <overWrite>false</overWrite>
>>> <outputDirectory>
>>> ${project.build.directory}/src/assembly/
>>> </outputDirectory>
>>> <destFileName>dist.xml</destFileName>
>>> </artifactItem>
>>> </artifactItems>
>>> </configuration>
>>> </plugin>
>>>
>>> furthermore I changed the descriptor of maven-assembly-plugin to use
>>> ${project.build.directory}/src/assembly/dist.xml. I didn't change
>>> anything to the child-projects.
>>>
>>> I can now execute "mvn clean dependency:copy assembly:assembly" for
>>> child projects to create a distribution-package.
>>>
>>> The only thing which I'm still insecure is about attaching this to
>>> phases, the difficulty seems that the super project doesn't need to
>>> have this attached to any phase, and the dependency resolution fails
>>> unless executed after install (a solution might be to split the parent
>>> into a grand-parent providing the assembly descriptor and binding it
>>> to phases in the intermediate parent). But I'm not sure anyway in
>>> which phase to best create zip and tar.
>>>
>>> Cheers,
>>> reto
>>>
>>> Stephen Connolly wrote:
>>>       
>>>> You could attach the common descriptor as a build artifact one
>>>> module, and
>>>> then use the dependency plugin to pull it down to each child module.
>>>>
>>>> i.e.
>>>>
>>>> Use buildhelper-maven-plugin in rwcf-apps to attach dist.xml with a
>>>> classifier of, e.g. assembly-descriptor.
>>>> Now when you run mvn install or mvn deploy on rwcf-apps the
>>>> descriptor will
>>>> be published to the maven repository (local or remote respectively)
>>>>
>>>> Then in one of the modules that you want to use this common
>>>> descriptor, add
>>>> a dependency on the rwcf-apps with a type of assembly-descriptor, you
>>>> use
>>>> maven-dependency-plugin to copy the dependency to your target
>>>> directory, and
>>>> then your pom just directs the assembly plugin to use that descriptor.
>>>>
>>>> -Stephen
>>>>
>>>> On Thu, Feb 21, 2008 at 8:47 PM, Reto Bachmann-Gmür <re...@gmuer.ch>
>>>> wrote:
>>>>
>>>>
>>>>         
>>>>> Hello
>>>>>
>>>>> I'm having many projects that share some dependencies and that
>>>>> should be
>>>>> packaged the same way. So I wanted to have a parent project configuring
>>>>> the maven-assembly-plugin.
>>>>>
>>>>> I did this with the following in the parent pom:
>>>>>
>>>>> ....
>>>>> <plugin>
>>>>> <artifactId>maven-assembly-plugin</artifactId>
>>>>> <configuration>
>>>>> <descriptors>
>>>>>
>>>>> <descriptor>../rwcf-apps/src/assembly/dist.xml</descriptor>
>>>>> </descriptors>
>>>>> </configuration>
>>>>>
>>>>>
>>>>> This only works when the parent is checked out in a sibling
>>>>> directory of
>>>>> the child. If one just check out a child project without checking out
>>>>> the parent assembly:assembly wont work. Things work using a
>>>>> descriptorRef but the predefined descriptors don't do what I'm looking
>>>>> for.
>>>>>
>>>>> Possibly ways to solve the issues might be:
>>>>>
>>>>> * have the plugin look up the descriptor from the parent rather
>>>>> * reference a descriptor with an http uri
>>>>> * include the content of descriptor directly in the pom
>>>>>
>>>>> ...but I didn't find a way to do it in any of these ways.
>>>>>
>>>>> Any suggestion on how to make it possible to check out a single
>>>>> child-project and being able to assemble it?
>>>>>
>>>>> If you would like to know more precisely what I'm doing, you may
>>>>> look at
>>>>>
>>>>> * The descriptor:
>>>>>
>>>>>
>>>>>           
>> https://knobot.svn.sourceforge.net/svnroot/knobot/rwcf-apps/trunk/src/assembly/dist.xml
>>     
>>>>> * The parent pom:
>>>>>
>>>>>
>>>>>           
>> https://knobot.svn.sourceforge.net/svnroot/knobot/rwcf-apps/trunk/pom.xml
>>     
>>>>> * A child pom:
>>>>>
>>>>>
>>>>>           
>> https://knobot.svn.sourceforge.net/svnroot/knobot/rwcf-app-webdav/trunk/pom.xml
>>     
>>>>> Cheers,
>>>>> reto
>>>>>
>>>>>
>>>>>
>>>>>           
>>>>         
>>>       
>>
>>     
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>   



Re: assembly plugin and project inheritance

Posted by Stephen Connolly <st...@gmail.com>.
there are two sets of goals in the maven dependency plugin.

the first set are copy and unpack. you specify the artifacts inside
the plugin configuration. these are not the set you want. the set you
want are copy-dependencies (or something like that I am on my iPod so
you will have to check) with this set you add the dependency to the
pom. that will force maven to sequence things correctly for you.

the build helper plugin has a default phase, so leave that alone. I
would bind the dependency plugin to one of the generate phases
(sources or resources)

Stephen
 2/22/08, Reto Bachmann-Gmür <re...@gmuer.ch> wrote:
> The version I posted doesn't work as the child-projects can't perform
> the attach-artifact attached to the package phase.
>
> I've now extracted the dist configuration and the attachment of it to a
> separate project[1]. Having done this I also attached the copy and the
> assembly goals to the compile and package phases [2].
>
>
> 1.
> http://knobot.svn.sourceforge.net/svnroot/knobot/rwcf-apps-assembly/trunk/pom.xml
> 2. in
> http://knobot.svn.sourceforge.net/svnroot/knobot/rwcf-apps/trunk/pom.xml
>
>
> Reto Bachmann-Gmür wrote:
> > Thanks Stephen,
> >
> > trying to follow the path you describe I added the following to the
> > parent-pom:
> >
> > <plugin>
> > <groupId>org.codehaus.mojo</groupId>
> > <artifactId>build-helper-maven-plugin</artifactId>
> > <executions>
> > <execution>
> > <id>attach-artifacts</id>
> > <phase>package</phase>
> > <goals>
> > <goal>attach-artifact</goal>
> > </goals>
> > <configuration>
> > <artifacts>
> > <artifact>
> > <file>src/assembly/dist.xml</file>
> > <type>xml</type>
> > <classifier>
> > assembly-descriptor
> > </classifier>
> > </artifact>
> > </artifacts>
> > </configuration>
> > </execution>
> > </executions>
> > </plugin>
> >
> > and
> > <plugin>
> > <groupId>org.apache.maven.plugins</groupId>
> > <artifactId>maven-dependency-plugin</artifactId>
> > <configuration>
> > <artifactItems>
> > <artifactItem>
> > <groupId>org.wymiwyg.rwcf</groupId>
> > <artifactId>rwcf-apps</artifactId>
> > <version>0.0.1</version>
> > <type>xml</type>
> > <classifier>assembly-descriptor</classifier>
> > <overWrite>false</overWrite>
> > <outputDirectory>
> > ${project.build.directory}/src/assembly/
> > </outputDirectory>
> > <destFileName>dist.xml</destFileName>
> > </artifactItem>
> > </artifactItems>
> > </configuration>
> > </plugin>
> >
> > furthermore I changed the descriptor of maven-assembly-plugin to use
> > ${project.build.directory}/src/assembly/dist.xml. I didn't change
> > anything to the child-projects.
> >
> > I can now execute "mvn clean dependency:copy assembly:assembly" for
> > child projects to create a distribution-package.
> >
> > The only thing which I'm still insecure is about attaching this to
> > phases, the difficulty seems that the super project doesn't need to
> > have this attached to any phase, and the dependency resolution fails
> > unless executed after install (a solution might be to split the parent
> > into a grand-parent providing the assembly descriptor and binding it
> > to phases in the intermediate parent). But I'm not sure anyway in
> > which phase to best create zip and tar.
> >
> > Cheers,
> > reto
> >
> > Stephen Connolly wrote:
> >> You could attach the common descriptor as a build artifact one
> >> module, and
> >> then use the dependency plugin to pull it down to each child module.
> >>
> >> i.e.
> >>
> >> Use buildhelper-maven-plugin in rwcf-apps to attach dist.xml with a
> >> classifier of, e.g. assembly-descriptor.
> >> Now when you run mvn install or mvn deploy on rwcf-apps the
> >> descriptor will
> >> be published to the maven repository (local or remote respectively)
> >>
> >> Then in one of the modules that you want to use this common
> >> descriptor, add
> >> a dependency on the rwcf-apps with a type of assembly-descriptor, you
> >> use
> >> maven-dependency-plugin to copy the dependency to your target
> >> directory, and
> >> then your pom just directs the assembly plugin to use that descriptor.
> >>
> >> -Stephen
> >>
> >> On Thu, Feb 21, 2008 at 8:47 PM, Reto Bachmann-Gmür <re...@gmuer.ch>
> >> wrote:
> >>
> >>
> >>> Hello
> >>>
> >>> I'm having many projects that share some dependencies and that
> >>> should be
> >>> packaged the same way. So I wanted to have a parent project configuring
> >>> the maven-assembly-plugin.
> >>>
> >>> I did this with the following in the parent pom:
> >>>
> >>> ....
> >>> <plugin>
> >>> <artifactId>maven-assembly-plugin</artifactId>
> >>> <configuration>
> >>> <descriptors>
> >>>
> >>> <descriptor>../rwcf-apps/src/assembly/dist.xml</descriptor>
> >>> </descriptors>
> >>> </configuration>
> >>>
> >>>
> >>> This only works when the parent is checked out in a sibling
> >>> directory of
> >>> the child. If one just check out a child project without checking out
> >>> the parent assembly:assembly wont work. Things work using a
> >>> descriptorRef but the predefined descriptors don't do what I'm looking
> >>> for.
> >>>
> >>> Possibly ways to solve the issues might be:
> >>>
> >>> * have the plugin look up the descriptor from the parent rather
> >>> * reference a descriptor with an http uri
> >>> * include the content of descriptor directly in the pom
> >>>
> >>> ...but I didn't find a way to do it in any of these ways.
> >>>
> >>> Any suggestion on how to make it possible to check out a single
> >>> child-project and being able to assemble it?
> >>>
> >>> If you would like to know more precisely what I'm doing, you may
> >>> look at
> >>>
> >>> * The descriptor:
> >>>
> >>>
> https://knobot.svn.sourceforge.net/svnroot/knobot/rwcf-apps/trunk/src/assembly/dist.xml
> >>>
> >>> * The parent pom:
> >>>
> >>>
> https://knobot.svn.sourceforge.net/svnroot/knobot/rwcf-apps/trunk/pom.xml
> >>>
> >>> * A child pom:
> >>>
> >>>
> https://knobot.svn.sourceforge.net/svnroot/knobot/rwcf-app-webdav/trunk/pom.xml
> >>>
> >>>
> >>> Cheers,
> >>> reto
> >>>
> >>>
> >>>
> >>
> >>
> >
> >
>
>
>

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


Re: assembly plugin and project inheritance

Posted by Reto Bachmann-Gmür <re...@gmuer.ch>.
The version I posted doesn't work as the child-projects can't perform 
the attach-artifact attached to the package phase.

I've now extracted the dist configuration and the attachment of it to a 
separate project[1]. Having done this I also attached the copy and the 
assembly goals to the compile and package phases [2].


1. 
http://knobot.svn.sourceforge.net/svnroot/knobot/rwcf-apps-assembly/trunk/pom.xml
2. in 
http://knobot.svn.sourceforge.net/svnroot/knobot/rwcf-apps/trunk/pom.xml


Reto Bachmann-Gmür wrote:
> Thanks Stephen,
>
> trying to follow the path you describe I added the following to the 
> parent-pom:
>
>            <plugin>
>                <groupId>org.codehaus.mojo</groupId>
>                <artifactId>build-helper-maven-plugin</artifactId>
>                <executions>
>                    <execution>
>                        <id>attach-artifacts</id>
>                        <phase>package</phase>
>                        <goals>
>                            <goal>attach-artifact</goal>
>                        </goals>
>                        <configuration>
>                            <artifacts>
>                                <artifact>
>                                    <file>src/assembly/dist.xml</file>
>                                    <type>xml</type>
>                                    <classifier>
>                                        assembly-descriptor
>                                    </classifier>
>                                </artifact>
>                            </artifacts>
>                        </configuration>
>                    </execution>
>                </executions>
>            </plugin>
>
> and
>            <plugin>
>                <groupId>org.apache.maven.plugins</groupId>
>                <artifactId>maven-dependency-plugin</artifactId>
>                <configuration>
>                    <artifactItems>
>                        <artifactItem>
>                            <groupId>org.wymiwyg.rwcf</groupId>
>                            <artifactId>rwcf-apps</artifactId>
>                            <version>0.0.1</version>
>                            <type>xml</type>
>                            <classifier>assembly-descriptor</classifier>
>                            <overWrite>false</overWrite>
>                            <outputDirectory>
>                                ${project.build.directory}/src/assembly/
>                            </outputDirectory>
>                            <destFileName>dist.xml</destFileName>
>                        </artifactItem>
>                    </artifactItems>
>                </configuration>
>            </plugin>
>
> furthermore I changed the descriptor of maven-assembly-plugin to use 
> ${project.build.directory}/src/assembly/dist.xml. I didn't change 
> anything to the child-projects.
>
> I can now execute "mvn clean dependency:copy assembly:assembly" for 
> child projects to create a distribution-package.
>
> The only thing which I'm still insecure is about attaching this to 
> phases, the difficulty seems that the super project doesn't need to 
> have this attached to any phase, and the dependency resolution fails 
> unless executed after install (a solution might be to split the parent 
> into a grand-parent providing the assembly descriptor and binding it 
> to phases in the intermediate parent). But I'm not sure anyway in 
> which phase to best create zip and tar.
>
> Cheers,
> reto
>
> Stephen Connolly wrote:
>> You could attach the common descriptor as a build artifact one 
>> module, and
>> then use the dependency plugin to pull it down to each child module.
>>
>> i.e.
>>
>> Use buildhelper-maven-plugin in rwcf-apps to attach dist.xml with a
>> classifier of, e.g. assembly-descriptor.
>> Now when you run mvn install or mvn deploy on rwcf-apps the 
>> descriptor will
>> be published to the maven repository (local or remote respectively)
>>
>> Then in one of the modules that you want to use this common 
>> descriptor, add
>> a dependency on the rwcf-apps with a type of assembly-descriptor, you 
>> use
>> maven-dependency-plugin to copy the dependency to your target 
>> directory, and
>> then your pom just directs the assembly plugin to use that descriptor.
>>
>> -Stephen
>>
>> On Thu, Feb 21, 2008 at 8:47 PM, Reto Bachmann-Gmür <re...@gmuer.ch> 
>> wrote:
>>
>>  
>>> Hello
>>>
>>> I'm having many projects that share some dependencies and that 
>>> should be
>>> packaged the same way. So I wanted to have a parent project configuring
>>> the maven-assembly-plugin.
>>>
>>> I did this with the following  in the parent pom:
>>>
>>> ....
>>> <plugin>
>>>        <artifactId>maven-assembly-plugin</artifactId>
>>>        <configuration>
>>>                <descriptors>
>>>
>>>  <descriptor>../rwcf-apps/src/assembly/dist.xml</descriptor>
>>>                </descriptors>
>>>        </configuration>
>>>
>>>
>>> This only works when the parent is checked out in a sibling 
>>> directory of
>>> the child. If one just check out a child project without checking out
>>> the parent assembly:assembly wont work. Things work using a
>>> descriptorRef but the predefined descriptors don't do what I'm looking
>>> for.
>>>
>>> Possibly ways to solve the issues might be:
>>>
>>>    * have the plugin look up the descriptor from the parent rather
>>>    * reference a descriptor with an http uri
>>>    * include the content of descriptor directly in the pom
>>>
>>> ...but I didn't find a way to do it in any of these ways.
>>>
>>> Any suggestion on how to make it possible to check out a single
>>> child-project and being able to assemble it?
>>>
>>> If you would like to know more precisely what I'm doing, you may 
>>> look at
>>>
>>>    * The descriptor:
>>>
>>> https://knobot.svn.sourceforge.net/svnroot/knobot/rwcf-apps/trunk/src/assembly/dist.xml 
>>>
>>>    * The parent pom:
>>>
>>> https://knobot.svn.sourceforge.net/svnroot/knobot/rwcf-apps/trunk/pom.xml 
>>>
>>>    * A child pom:
>>>
>>> https://knobot.svn.sourceforge.net/svnroot/knobot/rwcf-app-webdav/trunk/pom.xml 
>>>
>>>
>>> Cheers,
>>> reto
>>>
>>>
>>>     
>>
>>   
>
>



Re: assembly plugin and project inheritance

Posted by Reto Bachmann-Gmür <re...@gmuer.ch>.
Thanks Stephen,

trying to follow the path you describe I added the following to the 
parent-pom:

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-artifacts</id>
                        <phase>package</phase>
                        <goals>
                            <goal>attach-artifact</goal>
                        </goals>
                        <configuration>
                            <artifacts>
                                <artifact>
                                    <file>src/assembly/dist.xml</file>
                                    <type>xml</type>
                                    <classifier>
                                        assembly-descriptor
                                    </classifier>
                                </artifact>
                            </artifacts>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

and
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <configuration>
                    <artifactItems>
                        <artifactItem>
                            <groupId>org.wymiwyg.rwcf</groupId>
                            <artifactId>rwcf-apps</artifactId>
                            <version>0.0.1</version>
                            <type>xml</type>
                            <classifier>assembly-descriptor</classifier>
                            <overWrite>false</overWrite>
                            <outputDirectory>
                                ${project.build.directory}/src/assembly/
                            </outputDirectory>
                            <destFileName>dist.xml</destFileName>
                        </artifactItem>
                    </artifactItems>
                </configuration>
            </plugin>

furthermore I changed the descriptor of maven-assembly-plugin to use 
${project.build.directory}/src/assembly/dist.xml. I didn't change 
anything to the child-projects.

I can now execute "mvn clean dependency:copy assembly:assembly" for 
child projects to create a distribution-package.

The only thing which I'm still insecure is about attaching this to 
phases, the difficulty seems that the super project doesn't need to have 
this attached to any phase, and the dependency resolution fails unless 
executed after install (a solution might be to split the parent into a 
grand-parent providing the assembly descriptor and binding it to phases 
in the intermediate parent). But I'm not sure anyway in which phase to 
best create zip and tar.

Cheers,
reto

Stephen Connolly wrote:
> You could attach the common descriptor as a build artifact one module, and
> then use the dependency plugin to pull it down to each child module.
>
> i.e.
>
> Use buildhelper-maven-plugin in rwcf-apps to attach dist.xml with a
> classifier of, e.g. assembly-descriptor.
> Now when you run mvn install or mvn deploy on rwcf-apps the descriptor will
> be published to the maven repository (local or remote respectively)
>
> Then in one of the modules that you want to use this common descriptor, add
> a dependency on the rwcf-apps with a type of assembly-descriptor, you use
> maven-dependency-plugin to copy the dependency to your target directory, and
> then your pom just directs the assembly plugin to use that descriptor.
>
> -Stephen
>
> On Thu, Feb 21, 2008 at 8:47 PM, Reto Bachmann-Gmür <re...@gmuer.ch> wrote:
>
>   
>> Hello
>>
>> I'm having many projects that share some dependencies and that should be
>> packaged the same way. So I wanted to have a parent project configuring
>> the maven-assembly-plugin.
>>
>> I did this with the following  in the parent pom:
>>
>> ....
>> <plugin>
>>        <artifactId>maven-assembly-plugin</artifactId>
>>        <configuration>
>>                <descriptors>
>>
>>  <descriptor>../rwcf-apps/src/assembly/dist.xml</descriptor>
>>                </descriptors>
>>        </configuration>
>>
>>
>> This only works when the parent is checked out in a sibling directory of
>> the child. If one just check out a child project without checking out
>> the parent assembly:assembly wont work. Things work using a
>> descriptorRef but the predefined descriptors don't do what I'm looking
>> for.
>>
>> Possibly ways to solve the issues might be:
>>
>>    * have the plugin look up the descriptor from the parent rather
>>    * reference a descriptor with an http uri
>>    * include the content of descriptor directly in the pom
>>
>> ...but I didn't find a way to do it in any of these ways.
>>
>> Any suggestion on how to make it possible to check out a single
>> child-project and being able to assemble it?
>>
>> If you would like to know more precisely what I'm doing, you may look at
>>
>>    * The descriptor:
>>
>> https://knobot.svn.sourceforge.net/svnroot/knobot/rwcf-apps/trunk/src/assembly/dist.xml
>>    * The parent pom:
>>
>> https://knobot.svn.sourceforge.net/svnroot/knobot/rwcf-apps/trunk/pom.xml
>>    * A child pom:
>>
>> https://knobot.svn.sourceforge.net/svnroot/knobot/rwcf-app-webdav/trunk/pom.xml
>>
>> Cheers,
>> reto
>>
>>
>>     
>
>   



Re: assembly plugin and project inheritance

Posted by Stephen Connolly <st...@gmail.com>.
You could attach the common descriptor as a build artifact one module, and
then use the dependency plugin to pull it down to each child module.

i.e.

Use buildhelper-maven-plugin in rwcf-apps to attach dist.xml with a
classifier of, e.g. assembly-descriptor.
Now when you run mvn install or mvn deploy on rwcf-apps the descriptor will
be published to the maven repository (local or remote respectively)

Then in one of the modules that you want to use this common descriptor, add
a dependency on the rwcf-apps with a type of assembly-descriptor, you use
maven-dependency-plugin to copy the dependency to your target directory, and
then your pom just directs the assembly plugin to use that descriptor.

-Stephen

On Thu, Feb 21, 2008 at 8:47 PM, Reto Bachmann-Gmür <re...@gmuer.ch> wrote:

> Hello
>
> I'm having many projects that share some dependencies and that should be
> packaged the same way. So I wanted to have a parent project configuring
> the maven-assembly-plugin.
>
> I did this with the following  in the parent pom:
>
> ....
> <plugin>
>        <artifactId>maven-assembly-plugin</artifactId>
>        <configuration>
>                <descriptors>
>
>  <descriptor>../rwcf-apps/src/assembly/dist.xml</descriptor>
>                </descriptors>
>        </configuration>
>
>
> This only works when the parent is checked out in a sibling directory of
> the child. If one just check out a child project without checking out
> the parent assembly:assembly wont work. Things work using a
> descriptorRef but the predefined descriptors don't do what I'm looking
> for.
>
> Possibly ways to solve the issues might be:
>
>    * have the plugin look up the descriptor from the parent rather
>    * reference a descriptor with an http uri
>    * include the content of descriptor directly in the pom
>
> ...but I didn't find a way to do it in any of these ways.
>
> Any suggestion on how to make it possible to check out a single
> child-project and being able to assemble it?
>
> If you would like to know more precisely what I'm doing, you may look at
>
>    * The descriptor:
>
> https://knobot.svn.sourceforge.net/svnroot/knobot/rwcf-apps/trunk/src/assembly/dist.xml
>    * The parent pom:
>
> https://knobot.svn.sourceforge.net/svnroot/knobot/rwcf-apps/trunk/pom.xml
>    * A child pom:
>
> https://knobot.svn.sourceforge.net/svnroot/knobot/rwcf-app-webdav/trunk/pom.xml
>
> Cheers,
> reto
>
>