Kent Närling schrieb:
> Hi!
>
> I would like to be able to build a self-sufficient application package from
> a project into a zip/tar, ie with all dependencies and a prepared scrip to
> execute it.
>
> I have so far tried two approches:
>
> A, Using maven-assembly-plugin and creating my own assembly file
>     This has two problems:
>      1, I have set the dependency scope to runtime, but it still includes
> "the whole world"!
>          I mean, it even includes a lot of maven jar:s! (which are obviously
> not necessary to run the app)
>      2, It becomes very inconvenient to write the script and manually
> updating the jar:s that should be in the classpath... :-(
>
> B, Using the Mojo appassembler-maven-plugin, but this is very buggy... it
> even gives me nullpointer exceptions! :-(
>
> Anyone have tips about the best we to achive this?
>
> //Kent
>
>   
I've not seen any problems with maven-assembly-plugin trying to include
jars used only by maven plugins. Are you sure that's what is happening?
Running "mvn dependency:tree" will show you what your projects
dependencies are.

You might also want to look at the maven-shade-plugin. This can generate
an executable jar for a maven project, with all the necessary
dependencies bundled within it; very convenient. Unfortunately while the
plugin is great, the documentation is ****. It doesn't even mention this
very important feature.

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>1.1</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

Just make sure that the manifest file has a "Main-Class: ..." and all
works nicely.

Regards,
Simon


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to