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

removeContainers = false is broken when using gradle 8.x #405

Open
kwonglau opened this issue Jul 12, 2023 · 5 comments
Open

removeContainers = false is broken when using gradle 8.x #405

kwonglau opened this issue Jul 12, 2023 · 5 comments

Comments

@kwonglau
Copy link

it seems that the value is not override

@kwonglau
Copy link
Author

I got it working again when doing

getRemoveContainers() {
    return false;
}

however, this syntax is not recommended in gradle 8

@augi
Copy link
Member

augi commented Aug 9, 2023

Hello, what do you please mean by is broken? 🙏

@kwonglau
Copy link
Author

kwonglau commented Aug 9, 2023

I figured out the correct syntax a while ago and I forgot to update here.

If I have the following in gradle.properties

removeContainers=false

and If I have the following in build.gradle

dockerCompose {
   mysql {
      removeContainers = project.ext.removeContainers.toBoolean()
   }
}

the above will not work, removeContainers is calling the getter and the "=" is not mutating the removeContainers value. the correct syntax when using gradle 8 should be the following:

dockerCompose {
   mysql {
      removeContainers project.ext.removeContainers.toBoolean()
   }
}

removing the "=" will call the setter

@augi
Copy link
Member

augi commented Aug 10, 2023

That's interesting. Here you can see that the getRemoveContainers is Property<Boolean> so it should IMHO work 🤔

@kwonglau
Copy link
Author

I get what you mean. I have tried that and set break point to debug. but it didn't work.

This is actually broken for more than a year and I used to use

getRemoveContainers() {
    return false;
}

to get around the issue. And I just figure out a cleaner way to override the value using removeContainers project.ext.removeContainers.toBoolean()

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

2 participants