Wendy Smoak wrote:
On Jan 25, 2008 10:48 PM, Thomas Chang <[EMAIL PROTECTED]> wrote:
assumed we have a project with packaging jar. When we build the project with "mvn
package", a jar is build. But the dependencies in the project are not included in
the built jar. Is it possible to include the dependencies in the built jar?
Take a look at the assembly plugin. There are a few standard
assemblies... it sounds like jar-with-dependencies might be what you
want.
Yup, Wendy's right. Here's a sample we've used:
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorId>jar-with-dependencies</descriptorId>
<finalName>the-jar-name</finalName>
<outputDirectory>target/</outputDirectory>
<workDirectory>target/assembly/work</workDirectory>
<!-- include runtime deps -->
<scope>runtime</scope>
<archive>
<manifest>
<!-- a main class for using the jar from a shell -->
<mainClass>gr.abiss.someproject.App</mainClass>
<addClasspath>true</addClasspath>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<!-- this is used for inheritance merges -->
<phase>package</phase>
<!-- append to the packaging phase. -->
<goals>
<goal>attached</goal>
</goals>
</execution>
</executions>
</plugin>
hth,
Manos
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]