You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by David Whitehurst <dl...@gmail.com> on 2006/11/30 18:22:55 UTC

Classpath woes ...

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>dlwhitehurst@gmail.com</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>

Re: [m2] Offline Maven Docs - How???

Posted by franz see <fr...@gmail.com>.
Good day to you, Jens,

The only way i know is to check out the site from [1]. And as for the the
plugin docs, you'd have to check out the plugins and do mvn site on them.
That goes with the other maven modules that you would want to have their
documentation offline. you'd check out the corresponding module, and do mvn
site.

Cheers,
Franz

[1] http://svn.apache.org/repos/asf/maven/site/trunk/

Riboe, Jens wrote:
> 
> How can I download (or svn.export+mvn.site) the maven docs, user guides
> and plug-in docs?
> I'm often offline, and need access to these docs.
> Thanks.
> 	/Jens
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Classpath-woes-...-tf2733234s177.html#a7650336
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


[m2] Offline Maven Docs - How???

Posted by "Riboe, Jens" <Je...@ca.com>.
How can I download (or svn.export+mvn.site) the maven docs, user guides
and plug-in docs?
I'm often offline, and need access to these docs.
Thanks.
	/Jens


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Classpath woes ...

Posted by Jerome Lacoste <je...@gmail.com>.
On 11/30/06, David Whitehurst <dl...@gmail.com> wrote:
>
> 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.



1- do not crospost if possible.
2- this is probbably wrong

       <classpath>
               <!-- automatically creates the classpath using all project
dependencies,
                also adding the project build directory -->
         <dependency>log4j</dependency>
               </classpath>

use
       <classpath>
         <dependency>log4j:log4j</dependency>
       </classpath>

instead or just
       <classpath/>

J

Re: Classpath woes ...

Posted by Jerome Lacoste <je...@gmail.com>.
On 11/30/06, David Whitehurst <dl...@gmail.com> wrote:
>
> 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.



1- do not crospost if possible.
2- this is probbably wrong

       <classpath>
               <!-- automatically creates the classpath using all project
dependencies,
                also adding the project build directory -->
         <dependency>log4j</dependency>
               </classpath>

use
       <classpath>
         <dependency>log4j:log4j</dependency>
       </classpath>

instead or just
       <classpath/>

J