I have a gradle multi project with a subproject A. In the subproject A I have a build.gradle file with the following task:
import com.samples.*;
apply plugin: 'java'
apply plugin: 'maven'
sourceSets {
main {
java {
srcDir 'src'
}
}
}
task myTask(dependsOn: "classes") << {
MyClass m = new MyClass();
}
Where com.samples.MyClass is located in the source folder ‘src’. When I build this project with gradle clean install I get:
build file '....\build.gradle': 21: unable to resolve class MyClass
@ line 21, column 15.
MyClass m = new MyClass();
Why is MyClass not visible in the build script?