On Sun, Aug 7, 2011 at 2:01 AM, Peter Niederwieser <[email protected]>wrote:

>
> Kenneth Kousen wrote:
> >
> > I only want to execute the task if the test database does not exist.
> >
>
> You can add an output to the task, or use Task.onlyIf{}, or use
> Project.exec().
>

I understand that in principle, but if my build looks like this:

task generateTestDb(dependsOn:classes, type:JavaExec) {
    srcFile = file("src/main/groovy/service/populate_stadium_data.groovy")
    destFile = file("$buildDir/baseball.h2.db")
    inputs.file srcFile
    outputs.file destFile
    main = 'service.populate_stadium_data'
    classpath sourceSets.main.runtimeClasspath
}

test.dependsOn generateTestDb

then the generateTestDb task runs every time, despite the fact I have the
inputs and outputs properties set. What am I missing?

Ken

>
> --
> Peter Niederwieser
> Principal Engineer, Gradleware
> http://gradleware.com
> Creator, Spock Framework
> http://spockframework.org
> Twitter: @pniederw
>
> --
> View this message in context:
> http://gradle.1045684.n5.nabble.com/Run-groovy-script-from-gradle-with-classpath-tp4664822p4674399.html
> Sent from the gradle-user mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>


-- 
Kenneth A. Kousen
President
Kousen IT, Inc.

Reply via email to