gradle-docker-plugin
gradle-docker-plugin copied to clipboard
Fix Gradle 6.9.x support
Fixes a compatibility issue with Gradle 6.9.x
Without this builds fail with
> Task :dockerCreateDockerfile
FAILURE: Build failed with an exception.
* What went wrong:
Receiver class com.bmuschko.gradle.docker.tasks.image.Dockerfile$CopyFile does not define or inherit an implementation of the resolved method 'abstract java.lang.Object getProperty(java.lang.String)' of interface groovy.lang.GroovyObject.
2 actionable tasks: 2 executed
closes #1096
I am not sure if that will actually fix the issue. It seems more of a Groovy-compatibility issue as described here. My guess is that it is a binary-compatibility issue. One more reason to turn the Groovy production source code to Java.
@bmuschko Unfortunately I haven't seen any Gradle devs chime in wrt binary compatibility issues wrt groovy 2 and 3. Wish binary-compatibility would be something mentioned in their compatibility page. At present the existing docs are a little sparse on details.
FWIW I ran some of the existing functional tests against 6.9.2 via the method michel-kraemer talked about in https://github.com/bmuschko/gradle-docker-plugin/pull/1095 and found a few more places where this issue popped up. This fix is closer to whack-a-mole.
They basically say this here:
Gradle plugins written in Groovy must use Groovy 3.x for compatibility with Gradle and Groovy DSL build scripts.
Maybe it's better to migrate DockerExtension
to Java as well, not only DockerRegistryCredentials
? I can do this in my PR, as I'm already touching DockerExtension
in it: https://github.com/bmuschko/gradle-docker-plugin/pull/1111
We should move everything under src/main/groovy
to Java at once. That's the primary reason I will likely not merge this PR here. It will solve the binary incompatibility issue once and for all. Granted, it's quite a bit of work. Let me know if someone is willing to tackle it. At this time, I don't necessarily have the capacity to do this work by myself.
@bmuschko I can do it. Looks like not a lot of work for me. The question is how to do it without affecting other work, like this PR and all ongoing work on this issue: https://github.com/bmuschko/gradle-docker-plugin/issues/1102?
I think I can use this PR as a baseline. What do you think?
@donbeave That'd be great. Let's finish the two outstanding PRs and then we can start the work on converting Groovy to Java. It'll be less of a hassle. I am planning to merge the two outstanding PR by EOW.
Overall the PR looks good. A functional test is failing. Can you look into it? You may also want to merge master
back into your branch. I fixed a couple of tests.
@Sineaggi Is this still something you are planning to pursue? If you are not, let's close it.
I am going to close this PR for now. I'd be more than happy to reopen if you want to pick this back up.