question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Proper support for java-platform dependencies

See original GitHub issue

Environment:

  • 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:

  1. Create a multimodule project with a java-platform project
  2. Create a skaffold file to build it
  3. 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:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
loosebazookacommented, Feb 10, 2020

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.

0reactions
chanseokohcommented, Feb 25, 2020

@n8jones we’ve released Jib 2.1.0 with this fix.

@lightoze thank you for your great contribution!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Best practices for managing Java dependencies - Snyk
In this article, I'll give you some advice and best practices for dealing with Java dependencies in your project.
Read more >
The Java Platform Plugin - Gradle User Manual
The Java Platform plugin brings the ability to declare platforms for the Java ecosystem. A platform can be used for different purposes:.
Read more >
How to manage Java dependencies with Maven - Red Hat
Dependency management is crucial, especially when an architecture uses applications that don't package all artifacts in a zip archive.
Read more >
How to use Gradle "platforms" to align dependency versions in ...
No. If you have non-Java projects then you should not use the Java platform plugin. As the plugin name indicates, it's for Java...
Read more >
How to use Gradle api vs. implementation dependencies with ...
The Java Library Plugin is the recommended plugin to use when building libraries to be consumed by another project. It distinguishes between api ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found