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





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to