We do this by hand since the assembly plugin is too hard to use. You may give 
it a try:

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <!-- Copy this project's dependencies to the release/lib directory -->
          <execution>
            <id>copy-dependencies</id>
            <phase>package</phase>
            <goals>
              <goal>copy-dependencies</goal>
            </goals>
            <configuration>
              
<outputDirectory>${project.build.directory}/release-${project.version}/lib</outputDirectory>
              <includeScope>runtime</includeScope>
              <overWriteIfNewer>true</overWriteIfNewer>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <!-- Zip the release -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <id>packageApp</id>
            <phase>package</phase>
            <configuration>
              <tasks>
                <copy 
file="${project.build.directory}/${project.artifactId}-${project.version}.jar" 
todir="target/release-${project.version}/" />
                <zip 
destfile="${project.build.directory}/isoviewer-${project.version}.zip">
                  <zipfileset dir="target/release-${project.version}/" 
prefix="isoviewer" includes="**/*" />
                </zip>
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <!-- Deploy and Install the created ZIP file -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>attach-artifacts</id>
            <phase>package</phase>
            <goals>
              <goal>attach-artifact</goal>
            </goals>
            <configuration>
              <artifacts>
                <artifact>
                  
<file>${project.build.directory}/isoviewer-${project.version}.zip</file>
                  <type>zip</type>
                  <classifier>bin</classifier>
                </artifact>
              </artifacts>
            </configuration>
          </execution>
        </executions>
      </plugin>


      <!-- Create executable jar -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <archive>
            <manifest>
              <mainClass>iso.gui.Main</mainClass>
              <addClasspath>true</addClasspath>
              <classpathPrefix>lib</classpathPrefix>
            </manifest>
          </archive>
        </configuration>
      </plugin>


    </plugins>
  </build>

-----Ursprüngliche Nachricht-----
Von: zm [mailto:[EMAIL PROTECTED] 
Gesendet: Dienstag, 11. September 2007 22:24
An: users@maven.apache.org
Betreff: Maven 2 : Jar with included Jar dependencies


Hi,

I'm trying to create a jar using Maven 2, but I'm not getting what I whant
to ...

I have a jar project (main.jar) that depends on another jar (common.jar). My
poms are working correctly, but I need to create a self dependant main.jar.
That is, I need main.jar to include the common.jar, and access it without
any other external classpath info. I just want to execute "java -jar
main.jar" and voila ... executes nicelly.

Googling around I found no solution for the base jar "feature", but I heard
about plugins for Maven ... UberJar and JavaApp. Both should work fine with
Maven 1.x.

I'm using Maven 2.0.7, and I've read somewhere around my googling that this
"jar included dependencies" are already available in the base Maven 2
framework.

Now I just need some help to put it to works, as googling around is bringing
me many results that does not interest me, and maybe you know how to do it,
or point me to some link that helps ...

I'm new to Maven, and I really want to learn how to use it properly ... the
fact is that I also find it very difficult sometimes to find info about
pluggins, how to use them, their settings/usage ...

Anyway, any help regarding jars inside jars :) would be greatly appreciated.

Thanks.
-- 
View this message in context: 
http://www.nabble.com/Maven-2-%3A-Jar-with-included-Jar-dependencies-tf4425083s177.html#a12622970
Sent from the Maven - Users mailing list archive at Nabble.com.


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


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

Reply via email to