On 8/14/07, aldana <[EMAIL PROTECTED]> wrote:
>
> hi,
>
> does anybody know an alternative to assembly plugin which is mainly putting
> all stuff into a single jar.
>
> would prefer a layout where libraries are organized as following:
>
> -mainJar.jar
> -lib/
> -dependentJar1
> -dependentJar2
> -...
>
> the main task would be to set up Manifest.MF from mainJar.jar correctly so
> neccessary classpaths are set correctly and reference to outside living
> lib/*.jar.
This is two different piece of configuration effort.
First, configure pom so that, the Manifest of mainJar to add classpath
for all dependency, and also enable "classpathPrefix" configuration to
"lib".
Put this fragment in your pom:
<!-- Fragment in POM -->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib</classpathPrefix>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
Secondly, use assembly plugin, put all dependency to "lib/" and put
the mainjar to
top level, the assembly descriptor should be some like this:
<!-- Fragment in pom.xml -->
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>assemble</id>
<phase>package</phase>
<goals>
<goal>directory-inline</goal>
</goals>
</execution>
</executions>
<configuration>
<finalName>package</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/main/assembly/binary.xml</descriptor>
</descriptors>
</configuration>
</plugin>
</plugins>
</build>
<!-- File: assembly descriptor, src/main/assembly/binary.xml -->
<assembly>
<id>binary</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>true</includeBaseDirectory>
<baseDirectory>all-in-one</baseDirectory>
<fileSets>
<fileSet>
<includes>
<include>${artifactId}-*.jar</include>
</includes>
<directory>${basedir}/target</directory>
<outputDirectory>lib</outputDirectory>
<lineEnding>keep</lineEnding>
<fileMode>0644</fileMode>
</fileSet>
</fileSets>
<dependencySets>
<dependencySet>
<outputDirectory>lib</outputDirectory>
</dependencySet>
</dependencySets>
</assembly>
Cheers,
Zarick
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]