Hello,
I'm having a bit of a problem here !

I have a project that while not very big, does span a dependency tree a few
level deep and has many leaves of final deployed packages.  I use maven not
only to build and all but to generate zip files that contain everything
(doc, runtime environment, libraries, config files etc).  This makes the job
of people that have to deploy the modules a lot easier.

So..  Parent POM contains all that is necessary to build the base package,
most of which are set to not be inherited by the children as they will
simply use the parent Zip file package as a baseline and will complete or
override the necessary files to create the final packages.

My problem is this, in the parent I define some build tasks that will be
inherited by the children, namely :

<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
<inherited>true</inherited>
</plugin>
... snip ...
<plugin>
<inherited>true</inherited>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>attached</goal>
</goals>
</execution>
</executions>
<configuration>
<descriptors>
<descriptor>src/main/assembly/package.xml
</descriptor>
</descriptors>
</configuration>
</plugin>
</plugins>
</build>

I clipped out the extra fluff leaving the interesting bits.

In the child project I have this

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin
</artifactId>
<executions>
<execution>
<id>unpackProcessor</id>
<phase>package</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.purkinje</groupId>
<artifactId>ProcessorService</artifactId>
<classifier>package</classifier>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>target/processorPack
</outputDirectory>
</artifactItem>
</artifactItems>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
</configuration>
</execution>
</executions>
</plugin>
</plugins>

The goal is to be able to use the definition of the parent to create a
package based on the assembly rules (package.xml) that all child must have.
 My problem is that the assembly is executed BEFORE the unpacking and thus
will not include the parent`s file as intended.  The only workaround I found
to this is to redefine the assembly section in  each children thereby
nullifying the inheritance benefit...

Questions :
1 - can I control the order in which the build tasks are executed ?
2 - can I create dependencies amongst them so that the order of execution,
while not controlled in absolute, would still be respected and do the
intended work.
3 - is there a better way to achieve this knowing the children may very well
have some code inside along with documentation and configuration ?

Many thanks in advance

Éric

Reply via email to