Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[m2e-users] Corrupted Assembly, when using a type:pom dependency

Hi all,
 
I want to create an assembly, using a moduleSet. With the following (simplified) example, I select a certain artifact, define the output directory and provide a naming pattern.
<assembly>
 <id>distribution</id>
 <formats>
  <format>zip</format>
 </formats>
 <moduleSets>
  <moduleSet>
   <useAllReactorProjects>true</useAllReactorProjects>
   <includes>
    
<include>${artifact.groupId}:test.assembly.server</include>
   </includes>
   <binaries>
    
<outputDirectory>.</outputDirectory>
    <unpack>false</unpack>
    <outputFileNameMapping>${module.artifactId}.${module.extension}
    </outputFileNameMapping>
   </binaries>
  </moduleSet>
 </moduleSets>
</assembly>
 
The module I select in this assembly.xml contains one dependency:
<dependency>
   <groupId>de.hhla.test</groupId>
   <artifactId>test.assembly.core</artifactId>
   <version>0.0.1-SNAPSHOT</version>
   <type>pom</type>
</dependency>
 
The resulting assembly is unusable, as soon as the following two conditions are true:
- The module has a dependency with <type>pom</type>
AND
- The outputDirectory of the moduleSet is "."
 
In this case, the resulting assembly (e. g. zip file) looks like this:
ZIP
|
|-- ""
|    |-- test.assembly.server.jar
|
|-- test.assembly.server.jar
 
The file "test.assembly.server.jar", which is contained in that directory with an empty name, is not actually a jar, but the POM of the dependency, which I specified with <type>pom</type> !!! That's totally weird, isn't it?
Extracting this zip structure leads to a corrupted "test.assembly.server.jar", because the first jar in the dir with no name (which actually is an XML file) overwrites the correct jar at the actual root level of the zip file.
 
Another hint is this debug output of the assembly plugin:
[DEBUG] Adding file: C:\Dokumente und Einstellungen\<user>\.m2\repository\de\hhla\test\test.assembly.core\0.0.1-SNAPSHOT\test.assembly.core-0.0.1-SNAPSHOT.pom to archive location: TEST_0.0.1-SNAPSHOT//test.assembly.server.jar
(Please notice the two slashes in the destination path.)
 
Is this already a known issue or should I file a bug?
 
Thanks and best regards,
Stefan

Back to the top