maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig S. Cottingham <cr...@cottingham.net>
Subject Re: running the project out of maven.xml
Date Wed, 20 Oct 2004 22:34:19 GMT
On Oct 20, 2004, at 13:24, Ben Anderson wrote:

> I'd like to take advantage of the classpath which maven uses to run my 
> project.  I've tried to solutions:
> [ ... ]
> 2.   <ant:java classname="us.benanderson.rpc.Assignment3"
>                  classpath="${basedir}/target/classes"
>                  classpathref="maven.dependency.classpath"/>
>
> This makes a little more sense, but for some reason I'm getting this 
> output:
>
>    [java] [ERROR] java.lang.NoClassDefFoundError: org/w3c/dom/Document

Oh so close. Try adding 'fork="true"' to the ant:java tag.

It's possible to make a goal that's pretty flexible. For instance, 
here's what I use:

   <goal name="run" prereqs="java:compile,java:jar-resources">
     <ant:java classname="${classname}" fork="true">
       <ant:classpath>
         <ant:path refid="maven.dependency.classpath" />
         <ant:pathelement path="${maven.build.dest}" />
       </ant:classpath>
     </ant:java>
   </goal>

This requires defining "classname" on the command line, like:

   maven -Dclassname=net.cottingham.Test run

--
Craig S. Cottingham
craig@cottingham.net
OpenPGP key available from:
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x7977F79C


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


Mime
View raw message