I'm getting the error Could not get unknown property 'test' for project ': my-subproject' of type org.gradle.api.Project when I try to compile a gradle multiproject using a pipeline in VSTS. If I execute "gradlew build" directly in the project directory, it compiles correctly. But when I execute it through the VSTS pipeline, the error in question comes out.
Any idea what might be causing it?
settings.gradle of the MainProject
include ':my-subproject'
rootProject.name = 'MainProject'
MainProject build.gradle
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'eclipse'
apply plugin: 'jacoco'
group = 'co.com.something'
version = '1.0.0'
description = ""
sourceCompatibility = 1.7
targetCompatibility = 1.7
repositories {
maven { url "http://artifactory.mycompany.com/maven-mycompany/" }
maven { url "http://artifactory.mycompany.com/common-maven/" }
}
dependencies {
compile project(':my-subproject')
}
build.gradle of my-subproject
apply plugin: 'java'
apply plugin: 'jacoco'
group = 'co.com.mycompany'
version = '1.0.0'
description = ""
sourceCompatibility = 1.7
targetCompatibility = 1.7
repositories {
maven { url 'http://artifactory.mycompany.com/maven-mycompany/' }
maven { url "http://artifactory.mycompany.com/common-maven/" }
}
dependencies {
compile group: 'log4j', name: 'log4j', version:'1.2.14'
compile(group: 'commons-beanutils', name: 'commons-beanutils', version:'1.6')
testCompile group: 'junit', name: 'junit', version:'4.12'
}
Error in my pipeline
* What went wrong:
A problem occurred evaluating root project 'MainProject'.
> Could not get unknown property 'test' for project ':my-subproject' of type org.gradle.api.Project.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
See https://docs.gradle.org/4.8.1/userguide/command_line_interface.html#sec:command_line_warnings
https://help.gradle.org
BUILD FAILED in 3s
Error: D:\vsts-agents\agent4\_work\s\MainProject\gradlew.bat failed with return code: 1
at ChildProcess.<anonymous> (D:\vsts-agents\agent4\_work\_tasks\Gradle_8d8eebd8-2b94-4c97-85af-839254cc6da4.140.0\node_modules\vsts-task-lib\toolrunner.js:639:25)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:886:16)
at Socket.<anonymous> (internal/child_process.js:342:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Pipe._handle.close [as _onclose] (net.js:497:12)
##[error]Error: D:\vsts-agents\agent4\_work\s\MainProject\gradlew.bat failed with return code: 1