starting main from gradle

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

starting main from gradle

Johannes Zillmann
Hi there,

i have a project with a gradle build (JavaProject plugin).
Is it possible to start the main class of the project from a custom gradle task ?
With all the dependencies and resources in classpath ?

Johannes

PS: i wanted to send this mail to the users list, so i sent a subscribe mail. Have done this yesterday evening (and again 5 minutes before) but got no response yet...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
101tec GmbH
Halle (Saale), Saxony-Anhalt, Germany

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
101tec GmbH
Halle (Saale), Saxony-Anhalt, Germany

Reply | Threaded
Open this post in threaded view
|

Re: starting main from gradle

Adam Murdoch-2
Hi,

Something like this should do what you want:

createTask('run', dependsOn: 'compile') {
    ant.java(classname: 'MainClassName') {
        classpath(path: dependencies.antpath('runtime'))
        classpath(path: classesDir)
    }
}

You can then execute 'gradle run' to compile and run the main class.


Adam

Johannes Zillmann wrote:
Hi there,

i have a project with a gradle build (JavaProject plugin).
Is it possible to start the main class of the project from a custom gradle task ?
With all the dependencies and resources in classpath ?

Johannes

PS: i wanted to send this mail to the users list, so i sent a subscribe mail. Have done this yesterday evening (and again 5 minutes before) but got no response yet...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
101tec GmbH
Halle (Saale), Saxony-Anhalt, Germany

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
101tec GmbH
Halle (Saale), Saxony-Anhalt, Germany

--------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Reply | Threaded
Open this post in threaded view
|

Re: starting main from gradle

Johannes Zillmann
Hi Adam,

cool that works!
Just had to fork (ant.java(classname: 'MainClassName', fork:true)) to come around a 
java.lang.Error: can't load apple.laf.AquaLookAndFeel
     [java]     at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:194)

thanks
Johannes

On Sep 25, 2008, at 10:46 AM, Adam Murdoch wrote:

Hi,

Something like this should do what you want:

createTask('run', dependsOn: 'compile') {
    ant.java(classname: 'MainClassName') {
        classpath(path: dependencies.antpath('runtime'))
        classpath(path: classesDir)
    }
}

You can then execute 'gradle run' to compile and run the main class.


Adam

Johannes Zillmann wrote:
Hi there,

i have a project with a gradle build (JavaProject plugin).
Is it possible to start the main class of the project from a custom gradle task ?
With all the dependencies and resources in classpath ?

Johannes

PS: i wanted to send this mail to the users list, so i sent a subscribe mail. Have done this yesterday evening (and again 5 minutes before) but got no response yet...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
101tec GmbH
Halle (Saale), Saxony-Anhalt, Germany

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
101tec GmbH
Halle (Saale), Saxony-Anhalt, Germany

--------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
101tec GmbH
Halle (Saale), Saxony-Anhalt, Germany