Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup with Gradle subprojects causes configuration to fail #1182

Closed
malteesch opened this issue Jun 6, 2023 · 4 comments
Closed

Setup with Gradle subprojects causes configuration to fail #1182

malteesch opened this issue Jun 6, 2023 · 4 comments

Comments

@malteesch
Copy link

First, thanks for the amazing work here and I'm happy trying to help resolve the issue!
If there is further information needed I'm happy to provide it as quickly as possible.

Summary

Using different plugins in addition to docker-spring-boot-application in separate Gradle subprojects causes failure in the configuration phase of this plugin.

Expected Behavior

The plugins used in either of the subprojects should not cause the configuration phase of this plugin to fail.

Current Behavior

When using this plugin in two subprojects and then using a different one in only one of those projects breaks the build.

Context

I have a project where there are two subprojects. Both managed by Gradle.
Both of them use the docker-spring-boot-application plugin (same version, 9.3.0) and other identical plugins.
Now I want to use another plugin in only one of the subprojects.
When I try to do this I get the following error:

> Could not create task ':service2:dockerBuildImage'.
   > Cannot set the value of task ':service2:dockerBuildImage' property 'dockerClientService' of type com.bmuschko.gradle.docker.internal.services.DockerClientService using a provider of type com.bmuschko.gradle.docker.internal.services.DockerClientService.

Interestingly it doesn't matter in which of the subprojects I try to use the new plugin. The failure always occurs when in the configuration phase of service2.

Steps to Reproduce (for bugs)

I've attached an archive containing a minimal project (archive.tar.gz) to reproduce the error.
Going into one of the subprojects build scripts and uncommenting one of the commented plugins (liquibase or cyclonedx) and then running ./gradlew tasks causes the error to appear.

Your Environment

Gradle: 8.1.1
Java: 19 (GraalVM CE 22.3.1)
OS: Fedora 38

@meredrica
Copy link

same here, no idea what to do about it.

@bmuschko
Copy link
Owner

bmuschko commented Jun 12, 2023

In a multi-project build, you will want to apply plugins, as described here.

In root project:

plugins {
    id("com.bmuschko.docker-spring-boot-application") version "9.3.0" apply false
}

In subprojects:

plugins {
    id("com.bmuschko.docker-spring-boot-application")
}

The error you are seeing indicates that a specific internal service cannot be initiated multiple times per build. I am not sure if there's a way around it.

@malteesch
Copy link
Author

malteesch commented Jun 13, 2023

Thanks @bmuschko for the quick help!
The solution worked 👍

EDIT:
For the sake of completeness: You probably meant to link to here (applying plugin only on certain subprojects), right?

@bmuschko
Copy link
Owner

bmuschko commented Nov 3, 2023

@malteesch Yes, thanks. I fixed the link.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants