Tuesday, July 12, 2011

my maven assembly plugin

I want the provided dependencies in the current project and all the included submodules to take place in the current project's target/lib-lib directory.

the assembly.xml file :


<assembly xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" 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>assembly</id>
<formats>
<format>dir</format>
</formats>

<modulesets>
<moduleset>


<useallreactorprojects>true</useallreactorprojects>


<includes>


<include>CHILD-MODULE-1-GROUP-ID:
CHILD-MODULE-1-ARTIFACT-ID</include>
<include>CHILD-MODULE-2-GROUP-ID:CHILD-MODULE-2-ARTIFACT-ID</include>
</includes>

<binaries>
<dependencysets>
<dependencyset>
<outputdirectory>/lib-lib</outputdirectory>

<unpack>false</unpack>
<scope>provided</scope>
</dependencyset>
</dependencysets>
<includedependencies>true</includedependencies>
</binaries>
</moduleset>
</modulesets>

</assembly>


the pom.xml file :

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.2.1</version>
                <configuration>
                    <descriptors>
                        <descriptor>assembly.xml</descriptor>
                    </descriptors>
                </configuration>
            </plugin>
        </plugins>
    </build>

Now use the "package assembly:assembly" action to execute it.

No comments:

Post a Comment