You can use the assembly plugin with "jar-with-dependencies"
configuration to build the Jar you are looking for...

<build><plugins>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <descriptorId>jar-with-dependencies</descriptorId>
                    <archive>
                        <manifest>
                            <mainClass>ggg.MainApp</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>

HTH.
Wayne

On 4/13/06, Tim Kettler <[EMAIL PROTECTED]> wrote:
> Hi,
>
> just to be sure I understood your mail correctly:
>
> When you use maven to build your project and install/deploy it to your 
> repository all
> works as expected and the build suceeds. Now you want to actually run the 
> created project
> by invoking something like 'java -jar MAINJAR.jar' and the ClassDefNotFound 
> exception occurs.
>
> If the above is correct then maven does all what it can (and is designed to 
> do) for you.
> It doesn't provide build in support to set up a runtime classpath for your 
> application or
> any support to run the application at all.
>
> However there is a tool called pomstrap (http://pomstrap.tigris.org/) that 
> could be what
> you are looking for. I never tried it myself but from the description on the 
> website it
> looks like it could be what you want.
>
> Hope this helps
> -Tim
>
> G Virball schrieb:
> > Hello Maven Experts,
> >
> > I've been using Maven 2 for a few months, and I'm not sure if I've
> > stumbled upon a bug, or if a configuration change is in order.  I have
> > the following set of projects/subprojects:
> >
> > ProjA
> > -- SubProjA1
> > -- SubProjA2
> > -- SubProjA3
> > ...
> > -- SubProjAn
> >
> > ProjB
> > -- SubProjB1
> > -- SubProjB2
> > -- SubProjB3
> > -- SubProjB4
> >
> > ProjC
> > -- SubProjC1
> >
> > Here are the details surrounding the problem.  ProjA, ProjB, and ProjC
> > inherit from a common parent pom.xml.  All of the sub projects inherit
> > from their respective parent projects pom files.  SubProjA3 is dependent
> > upon SubProjA1 and SubProjA2, as well as SubProjB4 and SubProjC1.  The
> > appropriate dependencies exist in the various pom files, and the entire
> > set of projects and subprojects compiles successfully.  That's all good,
> > so here's the problem.  When I attempt to execute the jar file produced
> > by SubProjA3 (the main entry point to my program), I end up with an error:
> >
> > java.lang.NoClassDefFoundError
> >
> > with a reference to a class in SubProjB4.  (The manifest correctly
> > points to the main-class, otherwise I wouldn't be getting as far into
> > the execution as I am.)  This seems to be telling me that the classes
> > are being seen during compile time, but are not being properly
> > referenced in the local maven repository at runtime.  I've
> > double-checked, and each of the resulting subproject jars exist in the
> > local repository, so it seems like some sort of classpath issue within
> > maven.
> >
> > Any ideas on where to look for the problem?  It looks like the uberjar
> > plugin is not yet ready for maven2 (it didn't run for me).  I've also
> > tried to narrow it down by doing various minor refactoring experiments,
> > but no luck thus far.  (I can post additional information if helpful,
> > but I want to keep the message somewhat succinct to start.)
> >
> > Any ideas would be appreciated.  I've looked through the archives and
> > the documentation, so if I've inadvertently missed something, please
> > reply with a pointer.
> >
> > Best Regards,
> >
> > Glenn
> >
> >
> > ---------------------------------------------------------------------
> > 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