By the way, before you say that I'm mixing up the configuration phase with
the execution phase, if I simply change my task to:
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
}
then the build fails with the error "No main class specified". It's the
combination of the inputs/outputs and the JavaExec task that's giving me
problems.
Ken
On Sun, Aug 7, 2011 at 8:44 AM, Kenneth Kousen <[email protected]>wrote:
> 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.
>
>
--
Kenneth A. Kousen
President
Kousen IT, Inc.