El 16/10/2006 18:08, Sebastien Arbogast escribió:

I was trying to deliver my Maven2-built desktop application as a
single executable JAR with all dependencies included (using Assembly
plugin) when I realized that the default classloading mechanism
doesn't allow it. I had a look à One-Jar
(http://one-jar.sourceforge.net/) and I was told that UberJar did that
for Maven1.

Is there an equivalent for this kind of use with Maven2?

I also looked for a one-jar plug-in, and I didn't find it. Instead, I used assembly plug-in with these files:

-----------> pom.xml (into "build"):

<plugins>
        <!-- Propiedades de assembly -->
        <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <executions>
                        <execution>
                                <phase>package</phase>
                                <goals><goal>single</goal></goals>
                                <configuration>
                                        <descriptors>
                                                
<descriptor>src/main/assembly/assembly-bin.xml</descriptor>
                                        </descriptors>
                                        
<outputDirectory>target/distrib</outputDirectory>
                                        
<appendAssemblyId>true</appendAssemblyId>
                                        <archive>
<manifestFile>src/main/assembly/manifest/boot-manifest.mf</manifestFile>
                                        </archive>
                                </configuration>
                        </execution>
                </executions>
        </plugin>
        
        <!-- Manifest -->
        <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                        <archive>
                                <manifest>
                                        <mainClass>XXXXXXXXX [[[your main 
class]]]</mainClass>
                                        <addClasspath>true</addClasspath>
                                </manifest>
                        </archive>
                </configuration>
        </plugin>
        
</plugins>


---------> pom.xml ("dependencies")

<dependency>
        <groupId>com.simontuffs</groupId>
        <artifactId>one-jar-boot</artifactId>
        <version>0.95</version>
        <scope>runtime</scope>
</dependency>

---------> src/main/assembly/assembly-bin.xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<assembly>
        <id>all</id>
        
        <formats>
                <format>jar</format>
        </formats>
        
        <includeBaseDirectory>false</includeBaseDirectory>

        <dependencySets>
                <dependencySet>
                        <excludes>
                                <exclude>com.simontuffs:one-jar-boot</exclude>
                                
<exclude>${project.groupId}:${project.artifactId}</exclude>
                        </excludes>
                        <outputDirectory>/lib</outputDirectory>
                        <unpack>false</unpack>
                        <scope>runtime</scope>
                </dependencySet>
                
                <dependencySet>
                        <includes>
                                
<include>${project.groupId}:${project.artifactId}</include>
                        </includes>
                        <outputDirectory>/main</outputDirectory>
                        <unpack>false</unpack>
                        <scope>runtime</scope>
                </dependencySet>

                <dependencySet>
                        <includes>
                                <include>com.simontuffs:one-jar-boot</include>
                        </includes>
                        <outputDirectory>/</outputDirectory>
                        <unpack>true</unpack>
                        <scope>runtime</scope>
                </dependencySet>
        </dependencySets>
</assembly>

---------> src/main/assembly/manifest/boot-manifest.mf

Manifest-Version: 1.0
Main-Class: com.simontuffs.onejar.Boot
Class-Path: . config/. ../config/. ../.


--------> Additional files / actions:

* Deploy One-Jar into your repository (I didn't find it in ibiblio)

--------------------


Nonetheless, it would be great if a "one-jar" plug-in exist!

Hope it helps,

Andrés Viedma


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

Reply via email to