_jibSkaffoldFilesV2 fails with subproject dependencies
Environment:
- Jib version: 3.0.0
- Build tool:
jib-gradle-plugin - OS: Mac OSX 11.1 (20C69)
Description of the issue:
The gradle task _jibSkaffoldFilesV2 (used by skaffold) fails when defining implementation dependencies from a subproject.
Expected behavior:
This can be reproduced in the example project by commenting out the line
implementation project(':api')
$ ./gradlew clean _jibSkaffoldFilesV2
...
> Task :_jibSkaffoldFilesV2
BEGIN JIB JSON
{"build":["/Users/seth/projects/minimal-service/build.gradle","/Users/seth/projects/minimal-service/settings.gradle"],"in.....
Steps to reproduce:
git clone https://github.com/sethrylan/skaffold-minimal-service./gradlew clean _jibSkaffoldFilesV2
jib-gradle-plugin Configuration:
See https://github.com/sethrylan/skaffold-minimal-service/blob/main/build.gradle
plugins {
id 'java'
id 'org.springframework.boot' version '2.4.5'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'com.google.cloud.tools.jib' version '3.0.0'
}
group = 'org.example'
version = '0.0.1'
repositories {
mavenCentral()
}
configurations {
api
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
api project(':api')
implementation project(':api')
}
jib {
to {
image = "$project.name"
}
container {
mainClass = 'org.example.Application'
ports = ['8080']
}
}
Log output:
> Task :_jibSkaffoldFilesV2 FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':_jibSkaffoldFilesV2'.
> Configuration with name 'default' not found.
* 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 https://help.gradle.org
BUILD FAILED in 685ms
2 actionable tasks: 1 executed, 1 up-to-date
One workaround to this error is to name the configuration for subproject dependencies. E.g.,
implementation project(path: ':api', configuration: 'client')
instead of
implementation project(':api')
Although gradle's dependency resolution seems to figure out that the unnamed dependency matches client, the assumption of an empty configurationName as "default" doesn't work the same in FilesTaskV2.listFiles.
This seems like a bug, but it's probably not a high priority since there is a workaround. Thanks for the report! We welcome community contributions for this.
Keeping open as the bug is still valid AFAIK.