2

Hi I need to assembly jars from multimodule project in master directory. Let us have a structure like this:

MASTER(pom)
|
+-A3(pom)
| +-A1(jar)
| +-A2(jar)
+-B3(pom)
  +-B1(jar)
  +-B2(jar)

What I want to achieve is to assembly all jar packaged modules in MASTER.

jars/
+- A1.jar
+- A2.jar
+- B1.jar
+- B2.jar

For now I achieved only good resolution on submodules (A3 and B3) by creating pom.xml like:

<modules>
 <module>../A1</module>
 <module>../A2</module>
</modules>
<build>
    <plugins>
        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
                    <configuration>
                        <descriptors>
                            <descriptor>src/main/assembly/bin.xml</descriptor>
                        </descriptors>
                    </configuration>
        </plugin>
    </plugins>
 </build>

and assembly descriptor:

<moduleSets>
  <moduleSet>
    <includes>
      <include>org.mycompany:A1</include>
      <include>org.mycompany:A2</include>
    </includes>
    <binaries>
      <includeDependencies>false</includeDependencies>
      <outputDirectory>jars/${artifactId}</outputDirectory>
      <unpack>false</unpack>
    </binaries>
  </moduleSet>
</moduleSets>

When I do

mvn clean package assembly:assembly

on submodules (A3 or B3) separately they seem to assembly their own submodules fine.

I don't know how to specify assembly descriptor in MASTER. The one similar to A3 and B3 descriptor does not deal with it ([ERROR] you must specify at least one file). I tried several additional tags like includeSubModules... still nothing.

Deo
  • 138
  • 1
  • 2
  • 8
  • Where are your ``? – kan Feb 01 '12 at 09:38
  • i'm trying to assembly my modules, not their dependencies – Deo Feb 01 '12 at 09:41
  • Maybe I am wrong, but `` just tells to add other `pom`s in the reactor, but it doesn't provide any dependencies. So you cannot refer these modules anywhere, including assembly descriptors until you add dependencies. – kan Feb 01 '12 at 09:43
  • but if i add A1,A2,B1,B2 as dependencies insted of as modules they will not be built during package phase - just looked for in repository, don't they? – Deo Feb 01 '12 at 09:50
  • Obviously, if you want and build, and depend, you should add and `` and ``. – kan Feb 01 '12 at 09:54
  • Oh, looks like my assumption was correct. So, I make it as an answer so you will be able to close the question. – kan Feb 01 '12 at 10:07
  • nope, not that, i just can't post it yet – Deo Feb 01 '12 at 10:10

2 Answers2

1

Resolution as promised (Master Assembly Descriptor):

<moduleSets>
 <moduleSet>
    <binaries>
        <includeDependencies>false</includeDependencies>
        <outputDirectory>jars/${artifactId}</outputDirectory>
        <unpack>false</unpack>
    </binaries>
 </moduleSet>
</moduleSets>

as you can see - no pointing to specific modules with <include> like in A3 and B3

<includes>
 <include> 
  (...) 
 </include>
</includes>

this is strange indeed. Nevertheless working.

Deo
  • 138
  • 1
  • 2
  • 8
0

<module> just tells to add other poms in the reactor, but it doesn't provide any dependencies. So you cannot refer these modules anywhere, including assembly descriptors until you add dependencies.

If you want and build, and depend, you should add and <module> and <dependency>.

kan
  • 28,279
  • 7
  • 71
  • 101