solarwind
solarwind

Reputation: 337

Maven Assembly Plugin - Include other child dependencies in assembly

I have four child pom under one parent. One of the children is to build a zip containing the other 3 modules jars. This works but it doesn't pick up their respective dependencies.

module-build pom.xml :

...    
    <plugin>
       <artifactId>maven-assembly-plugin</artifactId>               
       <inherited>true</inherited>              
       <configuration>
          <descriptors>
             <descriptor>desc.xml</descriptor>
          </descriptors>
       </configuration>   
    </plugin>
...

desc.xml :

...

        <moduleSets>
            <moduleSet>
                <binaries>
                    <unpack>false</unpack>
                    <dependencySets>
                        <dependencySet>
                            <unpack>false</unpack>
                            <scope>runtime</scope>                  
                            <outputDirectory>lib</outputDirectory>
                        </dependencySet>
                    </dependencySets>
                </binaries>
            </moduleSet>
        </moduleSets>
    ...

The resultant 'lib' folder is not created.

Any help would be appreciated.

Upvotes: 1

Views: 1328

Answers (2)

Wim Deblauwe
Wim Deblauwe

Reputation: 26848

Do you have specified the other 3 modules as a dependency of this 4th module, next to being in the modules section of the parent?

If you do, it should work even if you do this:

<assembly>
 <id>final</id>
  <formats>
    <format>jar</format>
  </formats>
  <includeBaseDirectory>false</includeBaseDirectory>
  <dependencySets>
    <dependencySet>
        <unpack>false</unpack>
        <scope>runtime</scope>                  
        <outputDirectory>lib</outputDirectory>
    </dependencySet>
  </dependencySets>
</assembly>

Upvotes: 1

Jean-R&#233;my Revy
Jean-R&#233;my Revy

Reputation: 5677

Maybe it's a bit late, but no matter :). You should move your assembly at parent project, but that's not the real problem.

Using version of the plugin :

Here mine, wich is totally functional (but in French, forgive me ;))

<?xml version="1.0" encoding="UTF-8"?>
<assembly
    xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
    <!-- Ce chemin est lié au plugin maven-jar et à la génération du manifest 
        : à manipuler avec précautions -->
    <id>lib</id>
    <formats>
        <format>zip</format>
    </formats>
    <!-- Supprimer la création d'un répertoire dans l'archive au nom du projet -->
    <includeBaseDirectory>false</includeBaseDirectory>
    <dependencySets>
        <dependencySet>
            <outputDirectory>/</outputDirectory>
            <unpack>false</unpack>
            <scope>runtime</scope>
        </dependencySet>
    </dependencySets>
</assembly>

This is a built-in feature of the plugin (to get dependencies). But I'd never use it from a multimodule project, and I know that there is some tricky consideration with the use ob ModuleSet ...

Hope that will help...

Upvotes: 1

Related Questions