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 <[EMAIL PROTECTED]> 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





Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to