Does your jar have any dependencies? If not, then your case is a
little bit different from mine.
My (maybe not so simple) command line application depends on two jars.
If I just run "mvn package" I get a jar in the target directory like
you. However that jar doesn't include my application's two
dependencies. I have to distribute them separately in order to run my
application.
The assembly plugin's jar-with-dependencies descriptor seems designed
to solve this problem by generating a self-contained jar containing
all dependencies. I want to leverage this to generate a self-contained
jar, and then zip that jar up along with various support files
(readme, etc.).
The approach I'm trying right now is to use the provided
jar-with-dependencies descriptor along a custom descriptor. My pom
looks something like this:
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<descriptors>
<descriptor>my-custom-descriptor.xml</descriptor>
</descriptors>
</configuration>
My custom descriptor is similar to yours. The problem is when I enter
"mvn assembly:assembly" my custom descriptor is always processed
first, before the jar-with-dependencies descriptor. Naturally, the
self-contained jar doesn't exist yet, and I end up with a zip file
full of support files, but no jar.
In a sense, my custom descriptor depends on the jar-with-dependencies
descriptor being run first, but I have no idea how to express this. I
will look into creating multiple modules to see if it will solve my
problem, however it seems somewhat overkill for my application.
Thanks for your help Alexander.
On 12/4/06, Alexander Sack <[EMAIL PROTECTED]> wrote:
I won't speak for best practices but typically you would create another
module to do the packaging (similar to some of the EAR examples).
For a simple command-line application, my guess is one pom and one assembly
descriptor will be enough. For my command-line tool I generate the jar and
then assemble the whole applicaiton like so:
snippet from my assembly descriptor XML file:
<fileSets>
<fileSet>
<directory>target</directory>
<outputDirectory></outputDirectory>
<includes>
<include>*.jar</include>
</includes>
</fileSet>
<fileSet>
<outputDirectory></outputDirectory>
<directory>dist</directory>
<includes>
<include>*</include>
</includes>
</fileSet>
</fileSets>
Basically dist has some extra static files in it, target is where the JAR
gets built, and then the assembly plugin builds everything together.
-aps
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]