HI,
We’ve just upgraded to Gradle.1.5 (from 1.4) and we are getting the following error.
A problem occurred evaluating script.
> Could not find method sources() for arguments [task ':CM:packageSources', javabuild_4gk1hp1h9pj70smenaqqhte1bp$_run_cl
osure6_closure9@2c205e57] on project ':CM'.
Here’s the gradle file. The ‘sources’ configruation is used to package and upload source JAR’s into an Ivy repository. This works OK in Gradle 1.4 and I didn’t spot anything in the Gradle 1.5 release notes (or user guide) to explain the error.
apply plugin: 'java'
//gradle assumes java source code is in /src/main/java (a Maven convention) override this to use our 'src' directories
sourceSets.main.java.srcDirs = ['src']
sourceSets.main.resources.srcDirs = ['src']
sourceSets.test.java.srcDirs = ['test']
sourceSets.test.resources.srcDirs = ['test']
configurations {
sources
}
dependencies {
testCompile libs.junit
}
task packageSources(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
}
artifacts {
sources (packageSources) {
type = 'source'
}
}
//upload jar to Ivy repository
uploadArchives {
repositories {
add project.repositories.ivy_ois_repo
}
}
//upload jar to Ivy repository
uploadSources {
repositories {
add project.repositories.ivy_ois_repo
}
}
uploadArchives.dependsOn /* uploadJavadocs, */ uploadSources