Thank you too for the quick response.

Trust me, I've RTFMd for the last 4 days on this.  The documentation
is great if you already know what you want to do.  If you don't then
you spend 4 days digging, pulled along with the feeling that it's as
simple as the documentation and experts imply.

I got it to work.  For the list archives, here's what you do:

1. Use the assembly plugin
2. Create your own descriptor file
3. Copy everything manually.

Something I'd hoped wouldn't be necessary, a self-running jar is one
of those things I had assumed the toolchain would support easily.

Here's my POM.  Below that is the assembly file:
<?xml version="1.0" encoding="utf-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd";>
    <modelVersion>4.0.0</modelVersion>
    <groupId>edu.vt.iddl.mobile</groupId>
    <artifactId>Desktop</artifactId>
    <packaging>jar</packaging>
    <version>200801-SNAPSHOT</version>
    <name>Desktop</name>
    <url>http://maven.apache.org</url>
    <dependencies>
        <dependency>
            <groupId>edu.vt.iddl.groovy</groupId>
            <artifactId>GroovyBridge</artifactId>
            <version>200801-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-all</artifactId>
            <version>1.1-beta-3</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>swing</groupId>
            <artifactId>appframework</artifactId>
            <version>1.0.3</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>swing</groupId>
            <artifactId>swing-worker</artifactId>
            <version>1.1</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>net.java.dev.swing-layout</groupId>
            <artifactId>swing-layout</artifactId>
            <version>1.0.2</version>
        </dependency>
        <dependency>
            <groupId>commons-dbcp</groupId>
            <artifactId>commons-dbcp</artifactId>
            <version>1.2.2</version>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.14</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring</artifactId>
            <version>2.5</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <version>2.5</version>
        </dependency>
    </dependencies>
    <profiles>
        <profile>
            <id>netbeans-public</id>
            <activation>
                <property>
                    <name>netbeans.execution</name>
                    <value>true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-jar-plugin</artifactId>
                        <configuration>
                            <archive>
                                <manifest>
                                    <addClasspath>true</addClasspath>
                                    <classpathPrefix>lib</classpathPrefix>

<mainClass>edu.vt.iddl.mobileadmin.MobileAdminApp</mainClass>
                                </manifest>
                            </archive>
                        </configuration>
                    </plugin>
                    <plugin>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>nb</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>directory</goal>
                                </goals>
                                <configuration>

<descriptor>${basedir}/src/main/assemblies/netbeans-run.xml</descriptor>
                                    <finalName>executable</finalName>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>

<mainClass>edu.vt.iddl.mobileadmin.MobileAdminApp</mainClass>
                            <packageName>edu.vt.iddl.mobileadmin</packageName>
                            <addClasspath>true</addClasspath>
                        </manifest>
                        <manifestEntries>
                            <mode>development</mode>
                            <url>${pom.url}</url>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.2-beta-2</version>
                <configuration>
                    <descriptors>

<descriptor>${basedir}/src/main/assemblies/dist.xml</descriptor>
                    </descriptors>
                    <archive>
                        <manifest>

<mainClass>edu.vt.iddl.mobileadmin.MobileAdminApp</mainClass>
                            <packageName>edu.vt.iddl.mobileadmin</packageName>
                            <addClasspath>true</addClasspath>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

The assembly file: src/main/assemblies/dist.xml:
<?xml version="1.0" encoding="UTF-8"?>

<!--
    Document   : dist.xml
    Created on : April 14, 2008, 1:27 PM
    Author     : lally
    Description:
        Sets up the maven assembly plugin to build a proper jar.
-->

<assembly>
    <id>dist</id>
    <includeBaseDirectory>false</includeBaseDirectory>
    <formats>
        <format>jar</format>
    </formats>
    <dependencySets>
        <dependencySet>
            <outputDirectory></outputDirectory>
            <outputFileNameMapping></outputFileNameMapping>
            <unpack>true</unpack>
            <scope>runtime</scope>
        </dependencySet>
    </dependencySets>
    <fileSets>
        <fileSet>
            <directory>target/classes</directory>
            <outputDirectory></outputDirectory>
        </fileSet>
        <fileSet>
            <directory>src/main/scripts</directory>
            <outputDirectory>scripts</outputDirectory>
            <includes>
                <include>*.groovy</include>
            </includes>
        </fileSet>
        <fileSet>
            <directory>src/main/java</directory>
            <outputDirectory></outputDirectory>
            <includes>
                <include>**/*.properties</include>
            </includes>
        </fileSet>
        <fileSet>
            <directory>src/main/java</directory>
            <outputDirectory></outputDirectory>
            <includes>
                <include>**/*.png</include>
            </includes>
        </fileSet>
    </fileSets>
</assembly>






On Mon, Apr 14, 2008 at 3:27 PM, Manos Batsis
<[EMAIL PROTECTED]> wrote:
> Lally Singh wrote:
>
> > Thanks for the quick response.  I tried it, but I couldn't figure out how
> to:
> > 1. Get my .class files in there either.
> > 2. Set up the manifest.
> >
>
>  Here a sample conf we use that tell the plugin to:
>
>  1: Put all class files in one jar (including classes from dependencies)
>  2: Set the main class in the manifest
>
>  It's all there if you RTFM ;-)
>
>  hth,
>
>  Manos
>
>
>
>  <plugin>
>         <artifactId>maven-assembly-plugin</artifactId>
>         <configuration>
>           <!-- you need this to include classes from deps -->
>           <descriptorId>jar-with-dependencies</descriptorId>
>           <finalName>JAR_NAME_HERE</finalName>
>           <outputDirectory>target/</outputDirectory>
>           <workDirectory>target/assembly/work</workDirectory>
>           <scope>runtime</scope>
>           <archive>
>             <manifest>
>               <!-- use the following as the main class in the manifest -->
>               <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>
>             <goals>
>               <goal>attached</goal>
>             </goals>
>           </execution>
>         </executions>
>       </plugin>
>
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  For additional commands, e-mail: [EMAIL PROTECTED]
>
>



-- 
H. Lally Singh
Ph.D. Candidate, Computer Science
Virginia Tech

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

Reply via email to