Skip to content

Instantly share code, notes, and snippets.

@purplefox
Created August 1, 2012 07:59
Show Gist options
  • Save purplefox/3224773 to your computer and use it in GitHub Desktop.
Save purplefox/3224773 to your computer and use it in GitHub Desktop.
test {
classpath 'build/classes/main'
systemProperty 'vertx.test.timeout', 15
systemProperty 'vertx.mods', "$projectDir/build/tmp/mod-test"
systemProperty 'vertx.version', "$project.version"
testLogging.showStandardStreams = true
}
Gives error:
* What went wrong:
A problem occurred evaluating root project 'mod-redis'.
> Could not find method classpath() for arguments [build/classes/main] on root project 'mod-redis'.
In the docs it says classpath is a 'FileCollection' but doesn't tell me how to represent that textually in a task, nor give any examples.
@pledbrook
Copy link

Properties are configured using propertyName = value. FileCollections can be created using the files() method (amongst others).

test {
    classpath = files('build/classes/main')
    ...
}

And for documentation on file collections, you can always check the user guide.

@purplefox
Copy link
Author

Peter - If I change it to your suggestion I get the following error:

A problem occurred evaluating root project 'mod-redis'.

Cannot cast object '/home/tim/projects/vert-x/mod-redis/build/classes/main' with class 'java.io.File' to class 'org.gradle.api.file.FileCollection'

@danbev
Copy link

danbev commented Aug 1, 2012

You should be able to use one of the following to set the classpath property:

classpath = files('build/classes/main')
setClasspath(files('build/classes/main'))
setClasspath files('build/classes/main')

The classpath should default to the runtime classpath and perhaps you only need to add the testClassesDir in your particular case:

testClassesDir = file('build/classes/main');

@purplefox
Copy link
Author

Thanks, Peter already suggested that, but it doesn't work (see above)

@pledbrook
Copy link

Are you sure you have the 's'? files() returns a FileCollection, file() returns a File.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment