1

I am trying to build an assembly from my maven multi-module build with the maven shade plugin and the maven assembly plugin. What I need is a structure like that:

assembly.zip
------------- dllDir
----------------- some dll's located in sub-module
------------- .netDir
----------------- the full jar (consisting of all module jars) as .net lib (va ikvm)
------------- fulljarDir
----------------- the java full jar (consisting of all module jars)
----------------- the java api jar (only some classes)
----------------- full-jar sources
----------------- api-jar sources
------------- libs
----------------- All sub-module libs ("normal"-jar, sources-jar, jar-with-dependencies)
------------- extlibDir
----------------- some other jars/dlls that are located in some sub-module dirs
------------- docDir
----------------- some documentation (copied from assembly project itself)

Currently I am using the shade plugin in the assembly project to create the full-jar and the api-jar (all modules are described as dependencies of the assembly project) with their sources.

I collect the the jar's and dll's from the modules by using the assembly plugin (with and assembly descriptor):

<moduleSets>
    <moduleSet>
        <includeSubModules>false</includeSubModules>
        <sources>
            <outputDirectoryMapping>libs/${module.basedir.name}
            </outputDirectoryMapping>
            <excludeSubModuleDirectories>
                true
            </excludeSubModuleDirectories>
            <fileSets>
                <fileSet>
                    <directory>/target/</directory>
                    <includes>
                        <include>*dependencies.jar</include>
                        <include>*javadoc.jar</include>
                        <include>*sources.jar</include>
                    </includes>
                    <outputDirectory>/</outputDirectory>
                </fileSet>
                <fileSet>
                    <directory>/native/usblibs.Linux/Release/</directory>
                    <includes>
                        <include>*.so</include>
                    </includes>
                    <outputDirectory>../../dllDir</outputDirectory>
                </fileSet>
                <fileSet>
                    <directory>/native/usb.Linux/lib/libusb-1.0/</directory>
                    <includes>
                        <include>*.so</include>
                    </includes>
                    <outputDirectory>../../usb</outputDirectory>
                </fileSet>
                <fileSet>
                    <directory>/native/usb.Linux/lib/usblib/i386/
                    </directory>
                    <includes>
                        <include>*.so</include>
                    </includes>
                    <outputDirectory>../../usb</outputDirectory>
                </fileSet>
            </fileSets>
        </sources>
    </moduleSet>
</moduleSets>

The problem is now that I am using the shade plugin for compiling the fat jar (of all modules). But I am using modules as well, so the packaging needs to be pomand that leads to the bevaviour, that the shade plugin creates pom (with the sources in it) instead of a jar. If I use the <finalName>tag in shade, I can rename the full artifact to jar, but the gernerated sources are not renamed.

Any hints or tricks? Maybe there are better ways to produce such an assembly?

Best, Jan

6
  • It's not clear why if you use modules, the packaging should be pom? What modules do you refer? Assembly <moduleSets>? But they are unrelated to packaging.
    – dma_k
    Feb 13, 2013 at 15:33
  • If I choose packaging jar, I cannot add any modules in the modules section in the pom. I refer all the modules of the project in the pom to collect the dll's (that are generated in the build process) from the modules via the moduleSets.
    – Jan Engler
    Feb 14, 2013 at 8:07
  • Maybe I am on the wrong track...An idea to build an assemby like described in my original post is highly appreciated
    – Jan Engler
    Feb 14, 2013 at 8:28
  • Ah, OK! You'd better split a parent pom with modules. Now you want to mix too many things in one module. When you separate them you'll feel better, as two your modules will become simpler and will do just things they are aimed to do.
    – dma_k
    Feb 14, 2013 at 9:35
  • Ok, youre right, but I have already a separate parent pom, I have only the modules in the assembly pom, because of the assemby desriptor in my snippet drom above. I need to collect non-jars from the modules and I didn't find any way other than using the ModuleSets....:(
    – Jan Engler
    Feb 14, 2013 at 12:10

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.