You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Pierre Monestie <pm...@gmail.com> on 2006/04/24 21:42:23 UTC

Run a Main class

Hi,
Is there a simple way to run a Main class with maven? Something
similar to the java task in Ant? If so what is the way to configure
it?
I know the runtime plugin is not completed so I'm looking for an
intermediary solution.
Thanks in advance,
Pierre

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


Re: Run a Main class

Posted by Kristian Nordal <kr...@gmail.com>.
On 4/24/06, Pierre Monestie <pm...@gmail.com> wrote:
>
> Hi,
> Is there a simple way to run a Main class with maven? Something
> similar to the java task in Ant? If so what is the way to configure
> it?
> I know the runtime plugin is not completed so I'm looking for an
> intermediary solution.


You can use the execute plugin to run them directly:
http://mojo.codehaus.org/exec-maven-plugin/

There's also a plugin for assembling projects and generating bin files for
your main classes (appassembler, in the mojo sandbox). If you are interested
in this one, I can post more information about it.

--
Cheers,
Kristian

Re: Run a Main class

Posted by Pierre Monestie <pm...@gmail.com>.
Thanks very much for the help!! Once again this mailing list rocks!!!
pierrre

On 4/24/06, Kaare Nilsen <ka...@gmail.com> wrote:
> hehe except that the exec:java goal has a bug in the 1.0 version. It
> has a NPE if no system props are set. But an easy way to work around
> this bug is to add something like this in your pom..
>
>  <plugin>
>     <groupId>org.codehaus.mojo</groupId>
>      <artifactId>exec-maven-plugin</artifactId>
>      <configuration>
>          <mainClass>com.myapp.MyMainClass</mainClass>
>          <systemProperties>
>              <systemProperty>
>                  <key>dummyKey</key>
>                  <value>dummyValue</value>
>              </systemProperty>
>          </systemProperties>
>      </configuration>
>  </plugin>
>
>
> Then you can do your mvn exec:java with no probs.
>
> /Kaare
> On 24/04/06, Jesse McConnell <je...@gmail.com> wrote:
> > it is actually not in the sandbox anymore, version 1.0 was released a few
> > weeks ago :)
> >
> > On 4/24/06, Alexandre Poitras <al...@gmail.com> wrote:
> > >
> > > Still in the sandbox but works well :
> > > http://mojo.codehaus.org/exec-maven-plugin/
> > >
> > > On 4/24/06, Pierre Monestie <pm...@gmail.com> wrote:
> > > > Hi,
> > > > Is there a simple way to run a Main class with maven? Something
> > > > similar to the java task in Ant? If so what is the way to configure
> > > > it?
> > > > I know the runtime plugin is not completed so I'm looking for an
> > > > intermediary solution.
> > > > Thanks in advance,
> > > > Pierre
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > > For additional commands, e-mail: users-help@maven.apache.org
> > > >
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> >
> >
> > --
> > jesse mcconnell
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

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


Re: Run a Main class

Posted by Kaare Nilsen <ka...@gmail.com>.
hehe except that the exec:java goal has a bug in the 1.0 version. It
has a NPE if no system props are set. But an easy way to work around
this bug is to add something like this in your pom..

 <plugin>
    <groupId>org.codehaus.mojo</groupId>
     <artifactId>exec-maven-plugin</artifactId>
     <configuration>
         <mainClass>com.myapp.MyMainClass</mainClass>
         <systemProperties>
             <systemProperty>
                 <key>dummyKey</key>
                 <value>dummyValue</value>
             </systemProperty>
         </systemProperties>
     </configuration>
 </plugin>


Then you can do your mvn exec:java with no probs.

/Kaare
On 24/04/06, Jesse McConnell <je...@gmail.com> wrote:
> it is actually not in the sandbox anymore, version 1.0 was released a few
> weeks ago :)
>
> On 4/24/06, Alexandre Poitras <al...@gmail.com> wrote:
> >
> > Still in the sandbox but works well :
> > http://mojo.codehaus.org/exec-maven-plugin/
> >
> > On 4/24/06, Pierre Monestie <pm...@gmail.com> wrote:
> > > Hi,
> > > Is there a simple way to run a Main class with maven? Something
> > > similar to the java task in Ant? If so what is the way to configure
> > > it?
> > > I know the runtime plugin is not completed so I'm looking for an
> > > intermediary solution.
> > > Thanks in advance,
> > > Pierre
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>
>
> --
> jesse mcconnell
>
>

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


Re: Run a Main class

Posted by Jesse McConnell <je...@gmail.com>.
it is actually not in the sandbox anymore, version 1.0 was released a few
weeks ago :)

On 4/24/06, Alexandre Poitras <al...@gmail.com> wrote:
>
> Still in the sandbox but works well :
> http://mojo.codehaus.org/exec-maven-plugin/
>
> On 4/24/06, Pierre Monestie <pm...@gmail.com> wrote:
> > Hi,
> > Is there a simple way to run a Main class with maven? Something
> > similar to the java task in Ant? If so what is the way to configure
> > it?
> > I know the runtime plugin is not completed so I'm looking for an
> > intermediary solution.
> > Thanks in advance,
> > Pierre
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


--
jesse mcconnell

Re: Run a Main class

Posted by Alexandre Poitras <al...@gmail.com>.
Still in the sandbox but works well :
http://mojo.codehaus.org/exec-maven-plugin/

On 4/24/06, Pierre Monestie <pm...@gmail.com> wrote:
> Hi,
> Is there a simple way to run a Main class with maven? Something
> similar to the java task in Ant? If so what is the way to configure
> it?
> I know the runtime plugin is not completed so I'm looking for an
> intermediary solution.
> Thanks in advance,
> Pierre
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

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