I have written a Gradle plugin. The plugin createsa task that should copy dependencies into a folder. But the task is always up-to-date, and I have no idea what I make wrong:
My plugin/build script:
import org.gradle.api.*
import org.gradle.api.artifacts.*
import org.gradle.api.tasks.*
apply plugin: SamplePlugin
repositories { mavenCentral() }
dependencies { sample 'commons-lang:commons-lang:2.6' }
class SamplePlugin implements Plugin<Project> {
void apply(Project project) {
Configuration sample = project.configurations.add("sample")
project.task(type: Copy, "test") << {
from files(sample)
into "$buildDir/xxx"
}
}
}
Output:
:test UP-TO-DATE
BUILD SUCCESSFUL
Total time: 0.39 secs
Expected behaviour: Copy commos-lang-2.6.jar to the directory build/xxx