On Wed, Apr 7, 2010 at 12:49 PM, Tomek Kaczanowski <
[email protected]> wrote:

> Hello Adam,
>
> >>  2) how do I use the runtime
> >> dependencies to set up a classpath and execute a java process?  In
> >> other words, how do I set up a "runMyApp" gradle task?
> > You could use the Ant java task. For example:
> >
> > task runMyApp {
> >    dependsOn sourceSets.main.runtimeClasspath
> >    doFirst {
> >        ant.java(classname: 'MyMainClass', classpath:
> > sourceSets.main.runtimeClasspath.asPath, fork: true)
> >    }
> > }
> >
> Could you please explain what does this line do:
> "dependsOn sourceSets.main.runtimeClasspath"
> ?
> What does it mean to "depend on a source set" ?
>

In this case you depend on the runtime classpath of a source set not on a
source set.

sourceSets.main.runtimeClasspath returns the type FileCollection which
implements the interface Buildable. You can pass any Buildable to a
dependsOn, which is then resolved by the Buildable's getDependencies method.
In the case of the runtimeClasspath FileCollection, getDependencies returns
the tasks necessary to create the runtime classpath (compiling the sources,
building project dependencies, ...).

- Hans

--
Hans Dockter
Founder, Gradle
http://www.gradle.org, http://twitter.com/gradleorg
CEO, Gradle Inc. - Gradle Training, Support, Consulting
http://www.gradle.biz




>
> --
> Regards / Pozdrawiam
> Tomek Kaczanowski
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

Reply via email to