Search code examples
maven-2maven-3maven-assembly-plugin

maven assembly include all sub-module dependencies without "already added, skipping"


So I have a parent module with a bunch of sub-modules, and I'm trying to generate a zip file with all of the module jars and all of their dependencies. My assembly descriptor looks like (similar to this question):

<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">
    <id>bin</id>
    <formats>
        <format>zip</format>
    </formats>
    <moduleSets>
        <moduleSet>
            <useAllReactorProjects>true</useAllReactorProjects>
            <binaries>
                <outputDirectory>/</outputDirectory>
                <unpack>false</unpack>
                <dependencySets>
                    <dependencySet>
                        <outputDirectory>lib</outputDirectory>
                        <unpack>false</unpack>
                        <scope>runtime</scope>
                    </dependencySet>
                </dependencySets>
            </binaries>
        </moduleSet>
    </moduleSets>
</assembly>

Now in both maven 2 and maven 3 I'm seeing hundreds of messages that look like:

[INFO] distribution-0.5.1-SNAPSHOT/lib/commons-lang-2.4.jar already added, skipping
[INFO] distribution-0.5.1-SNAPSHOT/lib/spring-core-3.0.3.RELEASE.jar already added, skipping
[INFO] distribution-0.5.1-SNAPSHOT/lib/commons-logging-1.0.4.jar already added, skipping
[INFO] distribution-0.5.1-SNAPSHOT/lib/args4j-2.0.12.jar already added, skipping
[INFO] distribution-0.5.1-SNAPSHOT/lib/collections-generic-4.01.jar already added, skipping

I gather these are happening because many of my sub-modules share dependencies (and some sub-modules depend on other sub-modules) and maven is copying all transitive dependencies for each sub-module independently so there's a ton of repetition in there.

Is there a way I can keep maven from trying to copy the same dependencies multiple times? Or at least hide these "already added, skipping" messages when it tries to?


Solution

  • I doubt if there exist anything that allows Maven Assembly plug-in to mute. This would be a good option to provide.

    On other hand, you can ask Maven to suppress all output and run in quiet mode.

    mvn -h
    usage: mvn [options] [<goal(s)>] [<phase(s)>]
    Options:
      -q,--quiet    Quiet output - only show errors
    

    E.g.

    mvn -q clean package
    

    But, you will loose all the other build time information as well.