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
Multi module project setup fails apply plugin with Gradle 7 #206
Comments
I believe this is the same as this, right? If so, then yes, this is (we think) the last remaining issue for full Gradle 7 compatibility. But we though this wasn't going to affect users of Gretty, only building it. Please check the other issue for my thoughts on 2.x. @f4lco - what do you think about this - the problem and the proposed solution? |
Your proposal is reasonable 👍 I cannot tell for sure if you are missing something. Naturally, the design rationale for some of Gretty's code is lost. Perhaps Gradle did not have @chali would you feel comfortable opening a PR for the changes you described? That would be cool. |
@boris-petrov I think it is the same thing just in Gradle 7 it turned to hard failure instead of a warning. @f4lco Let me try to implement the change and let's see what happens :-) |
I had the same error using Gradle 7 and greety 3.0.4, I had to temporarily deactivate it using id(Config.BuildPlugins.gretty) version Config.BuildPlugins.grettyVersion |
I got the same error with gradle 7 and gretty 3.0.4, but it seems this fix was not included in the latest release. |
@marandaneto, @fokkoru - do you mind trying a snapshot version from JitPack? I believe it should contain all the fixes and should work on Gradle 7 and multi-module projects. |
@marandaneto, @fokkoru - Gradle 3.0.5 is out and should contain the fix for this. Please try it out! |
@boris-petrov worked, thanks a lot! |
When you have a multi module project and gretty plugin is applied in a submodule it fails to apply. The reason is this logic Following code iterates over all modules and registers
afterEvaluate
closure. It is invoked in a context of a submodule which applies gretty plugin. However the root project is already fully evaluated and it is too late to registerafterEvaluate
for it.You will get following error:
I'm thinking that the logic could be improved in the following way. There is a method
afterProjectEvaluate(proj)
which is invoked as part ofafterEvaluate
for each module. However inside of the method there is an check ifgretty
extension is present. That means for any submodule which doesn't havegretty
plugin it is NOOP. I think this part could be teased out outside and just register after evaluate as part of the pluginapply
. Am I missing something?Second part is quite complex logic with some state captured in the root project. I believe the goal was to have an
afterEvaluate
call which is done after all modules are evaluated. There is specialized callback in Gradle for that.Similarly to #205 I would love to have solution in 2.x chain and I'm offering my help if needed.
Stacktrace:
The text was updated successfully, but these errors were encountered: