bmuschko / gradle-docker-plugin

Gradle plugin for managing Docker images and containers.
https://bmuschko.github.io/gradle-docker-plugin/current/user-guide/
Apache License 2.0
1.23k stars 362 forks source link

Kotlin build breaks between 4.8.0 and 4.8.1 #808

Closed Jolter closed 5 years ago

Jolter commented 5 years ago

Expected Behavior

buildImage task should complete the same on 4.8.1 as on 4.8.0

Current Behavior

After updating to id 'com.bmuschko.docker-remote-api' version '4.8.1', my project can no longer find all dependencies for its Kotlin source set.

All projects evaluated.
Selected primary task 'buildImage' from project :ws
Could not resolve compiler classpath. Check if Kotlin Gradle plugin repository is configured in project ':ws'.

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':ws:compileJooqKotlin'.
> Could not resolve all files for configuration ':ws:kotlinCompilerClasspath'.
   > Cannot resolve external dependency org.jetbrains.kotlin:kotlin-compiler-embeddable:1.3.21 because no repositories are defined.
     Required by:
         project :ws

Toggling back to 4.8.0, it works again with a clean buildImage

The sibling subprojects that have no Kotlin code still work, and build their Docker images perfectly.

It's a rather complicated project setup with multiple subprojects and several languages, so I haven't had time to set up a minimum reproducible example.

I would venture a guess that one of the below commits made some change to the dependency resolution chain? https://github.com/bmuschko/gradle-docker-plugin/compare/v4.8.0...v4.8.1

Context

My buildImage task is set up like the following:

import com.bmuschko.gradle.docker.tasks.image.DockerBuildImage
task buildImage(type: DockerBuildImage) {
    dependsOn createDockerfile
    dependsOn check
    inputDir.set(project.file('build/docker'))
    version = jar.archiveVersion.get()
    tags.add("foo:$version")
}

The subproject also uses JOOQ to generate database code, that's why the task throwing the exception is called compileJooqKotlin.

Steps to Reproduce (for bugs)

I'll try to add a minimum reproduction example if you can't think of a reason for the breakage immediately.

Your Environment

Gradle 5.4.1 WSL on Windows 10 running Ubuntu LTS

Jolter commented 5 years ago

Perhaps unrelated: the commits 866a8dc6386591d34af0c072557ef2df41915f94 and 2f20a430f18318a4e9388cd5cb6383e0f809c6a6 are listed in the release notes for 4.8.0 but seem to actually have taken place in 4.8.1 unless I'm misreading that comparison listing.

bmuschko commented 5 years ago

See discussion here: https://github.com/bmuschko/gradle-docker-plugin/issues/794. You will have to define a repository in buildscript.repositories so that your dependencies in buildscript.dependencies can use it.

We corrected the release notes on master and will release an update with the next version.