Speeding up maven assembly of multiple modules -


i'm having project of following form

- pom.xml - projecta   - pom.xml   - src/main/     - java     - startupscript - projectb   - pom.xml   - src/main/     - java     - startupscript - projectassembly   - pom.xml 

i want projectassembly produce tar.gz contain 2 folders 1 projecta , 1 projectb, in each folder, there project's dependencies , startupscript library.

the "naive" way add assembly.xml file each project, file looks like:

<assembly> <formats>     <format>tar.gz</format> </formats> <basedirectory>/${project.artifactid}</basedirectory> <filesets>     <fileset>         <directory>${basedir}/src/main/startupscripts</directory>         <outputdirectory>/startupscripts</outputdirectory>     </fileset>  </filesets> <dependencysets>     <dependencyset>         <outputdirectory>/lib</outputdirectory>     </dependencyset> </dependencysets> </assembly> 

then, in projectassembly, depend on <type>tar.gz</type> of both projecta , projectb, , add assembly file looks like

<assembly> <dependencysets>     <dependencyset>         <outputdirectory>/</outputdirectory>         <unpack>true</unpack>     </dependencyset> </dependencysets> </assembly> 

this works, however, not need intermediate tar.gz of projects a , b, , producing them, if have lot of dependencies, takes long time.

how can tell maven directly assembly tar.gz of projectassembly without wasting times on packing , unpacking intermediate archives?

your assembly descriptor in projectassembly needs (see comments inside):

<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>dir</format> </formats> <includebasedirectory>false</includebasedirectory> <modulesets>   <moduleset>      <!-- enable access projects in current multimodule build! -->     <useallreactorprojects>true</useallreactorprojects>      <!-- now, select projects include in module-set. -->     <includes>       <include>*:projecta</include>       <include>*:projectb</include>     </includes>      <!-- select , map resources each module -->     <sources>       <includemoduledirectory>false</includemoduledirectory>       <filesets>         <fileset>           <directory>src/main/startupscript</directory>           <outputdirectory>${module.artifactid}/startupscript</outputdirectory>         </fileset>       </filesets>     </sources>     <!-- select , map dependencies each module -->     <binaries>       <dependencysets>         <dependencyset>           <outputdirectory>${module.artifactid}/lib</outputdirectory>         </dependencyset>       </dependencysets>     </binaries>   </moduleset> </modulesets> </assembly> 

i believe need. if not let know..


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -