Proper support for java-platform dependencies
See original GitHub issueEnvironment:
- Jib version: 2.0.0
- Build tool: Gradle 6.1.1, Skaffold 1.3.1
- OS: MacOS Catalina 10.15.3
Description of the issue: In a multi-module project, I have a project using the java-platform plugin that manages a group of dependencies and then I have several other applications that depend on that project in order to get their dependencies. When I attempt to build these docker images using skaffold I get the error in the log output below.
I attempted adding the runtimeClasspath configuration to my platform project, but then it complained about the java convention being missing. This problem seems to stem from the jib plugin expecting the java plugin to be applied, but java-platform does not allow for that.
I have attached a sample project that reproduces this error: jib-issue.tar.gz
Expected behavior:
Jib should correctly calculate the dependencies of a java-platform project.
Steps to reproduce:
- Create a multimodule project with a java-platform project
- Create a skaffold file to build it
- Run
skaffold dev
jib-gradle-plugin
Configuration:
plugins {
id 'com.google.cloud.tools.jib' version '2.0.0' apply false
}
project('core') {
apply plugin: 'java-library'
}
project('platform') {
apply plugin: 'java-platform'
javaPlatform {
allowDependencies()
}
dependencies {
api project(':core')
}
}
project('app') {
apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'com.google.cloud.tools.jib'
dependencies {
implementation project(':platform')
}
application {
mainClassName = 'jib.issue.App'
}
test {
useJUnitPlatform()
}
}
Log output:
Listing files to watch...
- jib-issue/app
FATA[0000] watching files for artifact jib-issue/app: listing files: listing files: getting jib-gradle dependencies: initial Jib dependency refresh failed: failed to get Jib dependencies: Running [/Users/****/jib-issue/gradlew _skaffoldFailIfJibOutOfDate -Djib.requiredVersion=1.4.0 :app:_jibSkaffoldFilesV2 -q]
- stdout:
- stderr:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:_jibSkaffoldFilesV2'.
> Configuration with name 'runtimeClasspath' 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 457ms
: exit status 1
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
I think descending into that project is for us to determine what to watch for skaffold. Those dependencies will still be included via the standard gradle dependency mechanism. As long as the java-platform projects don’t have source (They shouldn’t/can’t?) I think we’re fine - as it’s not a dependency that contains source.
@n8jones we’ve released Jib 2.1.0 with this fix.
@lightoze thank you for your great contribution!