Hello,

I have some questions about assembly and inheritance...
Purpose is to generate a tar.gz archive, containing a text file with the
list of checksums of the tar.gz content (excluding the checksums file itself
of course).
So the wanted order of execution would be :
- call assembly plugin with "directory-single" to generate folder
(prepare-package)
- call antrun plugin to generate checksums file from and in previous folder
(prepare-package)
- call assembly plugin with "single" to create final archive file
(package)

Antrun plugin is located first in list of plugins, and is binded to phase
"package", goal "run".

My assembly plugin is next and configured with the following executions :

<execution>
  <id>prepare-checksums</id>
  <phase>prepare-package</phase>
  <goals><goal>directory-single</goal></goals>
  <configuration>
    <descriptorRefs><descriptorRef>tar-gz</descriptorRef></descriptorRefs>
  </configuration>
</execution>
<execution>
  <phase>package</phase>
  <goals><goal>single</goal></goals>
  <configuration>

<descriptorRefs><descriptorRef>tar-gz-from-dir</descriptorRef></descriptorRefs>
  </configuration>
</execution>

The parent of this pom just declares assembly plugin and version, binding
the default execution to phase package and goal single, overloaded in this
pom.

If I bind the first execution (prepare-checksums) to "directory-single", the
following error occur :

[INFO] Error creating assembly: Error adding file
'com.gemalto.europetelcosoft.projects.country.customer.w_project_sample:SayHello:jar:1.0-SNAPSHOT'
to archive: Z:\MKS\CUBv2\Dev\sample-project-2.0.1\SayHello\target\classes
isn't a file.

This is not occurring only in m2eclipse, but in maven 2.2.1 command line
also.

The workaround I found, was to configure my assembly like this :

<execution>
  <id>prepare-checksums</id>
  <phase>package</phase>
  <goals><goal>directory-single</goal></goals>
  <configuration>
    <descriptorRefs><descriptorRef>tar-gz</descriptorRef></descriptorRefs>
  </configuration>
</execution>
<execution>
  <phase>package</phase>
  <goals><goal>assembly</goal></goals>
  <configuration>

<descriptorRefs><descriptorRef>tar-gz-from-dir</descriptorRef></descriptorRefs>
  </configuration>
</execution>

And configure antrun to be bound to package phase (and located after
assembly plugin).

So the execution becomes :
1- [assembly:single {execution: default}] generates the .tar.gz
2- [assembly:directory-single {execution: prepare-checksums}] generate
content folder
3- [antrun:run {execution: generate-checksum}] generates checksums the
checksum file
4- [assembly:assembly {execution: default}] generates tar.gz a second time
5- [assembly:single {execution: default}] generates tar.gz a third time
6- [assembly:directory-single {execution: prepare-checksums}] again
7- [antrun:run {execution: generate-checksum}]

I believe step 4 is the beginning of the forked life-cycle caused by goal
"assembly". Then all package phase is re-executed. I believe also that
"default" executions of "assembly:single" come from the parent pom, while
"default" executions of "assembly:assembly" come from this pom. Strangely,
it seems these default executions are not overloaded but executed twice,
maybe because goal is different. That being so, it's not possible to use
"skipAssembly" on the child pom for the "assembly:single", because you're
not permitted to declare the same execution twice in the same pom (even
though both are executed, it's a bit strange).
As expected, removing the assembly plugin declaration in the parent removes
steps 1, 5 and 6.

So I see 2 problems here, and would be grateful to hear any comments :
- why isn't it possible to bind "assembly:directory-single" to another phase
than "package" ?
- why the default execution is not inherited the same way named executions
are ? Why Maven would consider 2 different "default" executions in parent
and child only because goal is different ? I would expect the child to
impose it's declared goal.


I'm using Maven 2.2.1 command-line.

Thanks for help,
Jeremie

Reply via email to