Hello Matthias,

Read this:
http://maven.apache.org/plugins/maven-assembly-plugin/usage.html

You can use
mvn assembly:assembly
To get a jar with all dependencies.

BR,
Shanbo


On Mon, Mar 8, 2010 at 10:10 PM, Milos Kleint <[email protected]> wrote:

> On Mon, Mar 8, 2010 at 3:03 PM, Matthias Hofmann <
> [email protected]> wrote:
>
> > Hi,
> >
> > currently i am trying to get my Java program running outside of the
> > Netbeans IDE. Within Netbeans, it works well, all dependencies are
> > correctly loaded and executed.
> > But if i try to run the program from the console with java -cp or java
> > -jar, i get NoClassFoundDefError concerning the dependencies of the
> > project.
> >
> > My pom.xml uses
> >
> > <plugin>
> >                <groupId>org.apache.maven.plugins</groupId>
> >                <artifactId>maven-jar-plugin</artifactId>
> >                <configuration>
> >                    <archive>
> >                        <manifest>
> >                            <mainClass>...omitted...</mainClass>
> >                            <addClasspath>true</addClasspath>
> >
>
> this willl just generate the relevant manifest entry, but will not ensure
> that the jars are at the designated location at runtime. To get them there,
> you could use the maven-assembly plugin, or you could merge all dependency
> jars into the main jar using the maven-shade-plugin.
>
> Milos
>
>
> >                        </manifest>
> >                    </archive>
> >                </configuration>
> >            </plugin>
> >
> > as buildoptions
> >
> > Any ideas concerning this issue? Most likely, sth. with the classpath is
> > wrong, but i can't figure it out.
> >
> > Best regards and thank you,
> >
> > Matthias
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> >
> >
>



-- 
Shanbo Li

Master student
Software Engineering of Distributed Systems, KTH

Reply via email to