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.

Too many tasks executed on jib build

See original GitHub issue

Description of the issue: While using the jib gradle task (jib) the Plugin configures the jib tasks to depend on ALL assemble tasks on all upstream projects in a multi project build. This causes lots of unecessary artifacts being build even if only the jar (default dependency) of any upstream project is used.

Expected behavior: If the plugin is applied only the default dependency should be used, which in fact is already evaluated for the build of the project (jar/classes). So there should be no need at all to depend on anything on the parent projects. If specific artifacts are needed by a specific project the project should configure this dependency itself, it should not be hard coded within the Jib Plugin itself.

Steps to reproduce:

Its in the original code: ` COPIED FROM JibPlugin.java:

        // Find project dependencies and add a dependency to their assemble task. We make sure
        // to only add the dependency after BasePlugin is evaluated as otherwise the assemble
        // task may not be available yet.
        List<Project> computedDependencies = getProjectDependencies(projectAfterEvaluation);
        for (Project dependencyProject : computedDependencies) {
          dependencyProject
              .getPlugins()
              .withType(
                  BasePlugin.class,
                  unused -> {
                    TaskProvider<Task> assembleTask =
                        dependencyProject.getTasks().named(BasePlugin.ASSEMBLE_TASK_NAME);
                    buildImageTask.configure(task -> task.dependsOn(assembleTask));
                    buildDockerTask.configure(task -> task.dependsOn(assembleTask));
                    buildTarTask.configure(task -> task.dependsOn(assembleTask));
                  });
        }

` If some kind of dependency is really required, there should be a minimal dependency setup from any required project. Normally this should only be the “default” gradle artifact - including the classpath.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
chanseokohcommented, Feb 25, 2020

@bs-git we’ve released Jib 2.1.0 with the fix.

@seanabraham thanks for your great contribution!

1reaction
seanabrahamcommented, Jan 25, 2020

@loosebazooka I took a shot at it and put it up at https://github.com/GoogleContainerTools/jib/pull/2247. I think public apis give you enough actually to get it done pretty cleanly as long as you depend on the FileCollection and let Gradle do the rest (FileCollections maintain mappings of which tasks produce which artifacts).

Read more comments on GitHub >

github_iconTop Results From Across the Web

google/jib - Gitter
Hello hello. New to jib, using it via gradle. Is there a way to utilize jib as a task type to create say...
Read more >
using jib for multiple project build - spring boot - Stack Overflow
When I try to build them via gradle jib I get the following error: > Task :jib FAILED ... What went wrong: Execution...
Read more >
Building Java container images using Jib - Snyk
In this article, we will look at Jib, a 100% Java-based tool for Java developers to build highly optimized images for their Java...
Read more >
Dockerizing Java Apps using Jib - Baeldung
This saves us separate docker build/push commands and simplifies adding this to a CI pipeline. There are a couple of other tools out...
Read more >
Containerizing Spring Boot Application with Jib - Medium
Jib v/s Docker build flow(Image source Google Cloud). Wow, this is really powerful ... [INFO] Executing tasks: [INFO] [INFO] Executing tasks ...
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