I'm using Maven to do a number of things and I'm unable to obtain access to
a jar dependency using two plugins to accomplish my purpose.  First I use
maven to jar my application and it writes an executable JAR file and a
manifest that contains my needed Jar file for log4j.

I then use the maven-exec-plugin to execute the jarred application from the
command line using using "mvn exec:exec".  I have tried all combinations of
configurations and ... my goal is not to have to copy the log4j jar into my
target directory.  That's the only way I can see the jar on the classpath.
The maven-exec-plugin site says that the jars will be seen on the classpath
automatically.

And, I'm "USING" maven because I build and do everything else using Maven.
Does anyone have any suggestions as to the *BEST* way to run an executable
JAR made by Maven and needing a project dependency?

Thanks,

David

Here's the manifest

Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven
Built-By: piratepete
Build-Jdk: 1.5.0_08
Package: org.appfuse
Main-Class: org.appfuse.ApplicationMain
Class-Path: junit-3.8.1.jar log4j-1.2.13.jar

And, the project's pom

<?xml version="1.0" encoding="UTF-8"?>

<!--
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
-->

<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>org.appfuse</groupId>
   <artifactId>quickstart</artifactId>
   <packaging>jar</packaging>
   <name>AppFuse QuickStart</name>
   <version>1.0-SNAPSHOT</version>
   <inceptionYear>2006</inceptionYear>
   <url>http://appfuse.dev.java.net</url>

   <prerequisites>
       <maven>2.0.4</maven>
   </prerequisites>
<!--
   <scm>
       <connection>scm:svn:
https://appfuse.dev.java.net/svn/appfuse/trunk/quickstart</connection>
       <developerConnection>scm:svn:
https://appfuse.dev.java.net/svn/appfuse/trunk/quickstart
</developerConnection>
       <url>
https://appfuse.dev.java.net/source/browse/appfuse/trunk/quickstart</url>
   </scm>
-->

   <licenses>
       <license>
           <name>The Apache Software License, Version 2.0</name>
           <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
           <distribution>repo</distribution>
       </license>
   </licenses>

   <developers>
       <developer>
           <id>dlwhitehurst</id>
           <name>David Whitehurst</name>
           <email>[EMAIL PROTECTED]</email>
           <organization>CIBERsites ADM US</organization>
           <timezone>-6</timezone>
       </developer>
   </developers>

   <build>
       <defaultGoal>install</defaultGoal>
       <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>org.appfuse.ApplicationMain</mainClass>
                   <packageName>org.appfuse</packageName>
               <addClasspath>true</addClasspath>
                   </manifest>
       </archive>
       </configuration>
       </plugin>
       <plugin>
           <groupId>org.codehaus.mojo</groupId>
           <artifactId>exec-maven-plugin</artifactId>
           <executions>
               <execution>
                   <goals>
                       <goal>exec</goal>
                   </goals>
               </execution>
           </executions>
           <configuration>
               <executable>java</executable>
           <arguments>
               <argument>-jar</argument>
               <argument>-classpath</argument>
       <classpath>
               <!-- automatically creates the classpath using all project
dependencies,
                also adding the project build directory -->
         <dependency>log4j</dependency>
               </classpath>
               <argument>target/quickstart-1.0-SNAPSHOT.jar</argument>
           </arguments>
       </configuration>
     </plugin>
           <plugin>
               <artifactId>maven-eclipse-plugin</artifactId>
               <configuration>
                   <additionalProjectnatures>
                       <projectnature>
org.springframework.ide.eclipse.core.springnature</projectnature>
                   </additionalProjectnatures>
                   <additionalBuildcommands>
                       <buildcommand>
org.springframework.ide.eclipse.core.springbuilder</buildcommand>
                   </additionalBuildcommands>
                   <downloadSources>true</downloadSources>
                   <downloadJavadocs>true</downloadJavadocs>
                   <wtpversion>1.0</wtpversion>
               </configuration>
           </plugin>
           <plugin>
               <artifactId>maven-idea-plugin</artifactId>
               <configuration>
                   <downloadSources>true</downloadSources>
                   <downloadJavadocs>true</downloadJavadocs>
                   <dependenciesAsLibraries>true</dependenciesAsLibraries>
                   <useFullNames>false</useFullNames>
               </configuration>
           </plugin>
       </plugins>
   </build>

   <repositories>
       <repository>
           <id>central</id>
           <url>http://repo1.maven.org/maven2</url>
       </repository>
   </repositories>

   <pluginRepositories>
       <pluginRepository>
           <id>maven-snapshots</id>
           <url>http://snapshots.repository.codehaus.org</url>
       </pluginRepository>
   </pluginRepositories>

   <dependencies>
       <dependency>
           <groupId>junit</groupId>
           <artifactId>junit</artifactId>
           <version>${junit.version}</version>
           <optional>true</optional>
       </dependency>
       <dependency>
           <groupId>log4j</groupId>
           <artifactId>log4j</artifactId>
           <version>${log4j.version}</version>
       </dependency>
       <dependency>
           <groupId>ant</groupId>
           <artifactId>ant</artifactId>
           <version>1.6.5</version>
       </dependency>
   </dependencies>

   <reporting>
       <plugins>
           <plugin>
               <artifactId>maven-checkstyle-plugin</artifactId>
           </plugin>
           <plugin>
               <groupId>org.codehaus.mojo</groupId>
               <artifactId>cobertura-maven-plugin</artifactId>
           </plugin>
           <plugin>
               <artifactId>maven-javadoc-plugin</artifactId>
           </plugin>
           <plugin>
               <artifactId>maven-jxr-plugin</artifactId>
           </plugin>
           <plugin>
               <artifactId>maven-pmd-plugin</artifactId>
           </plugin>
           <plugin>
               <artifactId>maven-surefire-report-plugin</artifactId>
           </plugin>
       </plugins>
   </reporting>

   <properties>
       <junit.version>3.8.1</junit.version>
       <log4j.version>1.2.13</log4j.version>
   </properties>
</project>

Reply via email to