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

Incremental cache lost after a compilation error when using Micronaut #19453

Closed
nassimus26 opened this issue Dec 30, 2021 · 12 comments · Fixed by #20950
Closed

Incremental cache lost after a compilation error when using Micronaut #19453

nassimus26 opened this issue Dec 30, 2021 · 12 comments · Fixed by #20950
Labels
a:bug in:annotation-processing processor annotation incremental isolated aggregating apt kapt
Milestone

Comments

@nassimus26
Copy link

nassimus26 commented Dec 30, 2021

The cache is lost after any compilation error when Micronaut-inject is shipped with the project, so for example :

1- Build this project a first time

2- Make a build error, for example by removing any parentheses on the line 12 ( log.debug ) of the test.Application class in the /grails-app/init folder, please note that Micronaut injection must be triggered in the code, that's why I added the first line TriggerMicronaut.getDeclaredField("name") by calling reflection API

3- Build the project, so the build will fails

4- Correct the code, to succeed the next compilation

5- Rebuild the project, here, instead of having an incremental build (just one file), we got the message :

> Task :compileGroovy
Build cache key for task ':compileGroovy' is 8155b9162e73ad3dbcf1e6e45d38c585
Task ':compileGroovy' is not up-to-date because:
  Task has failed previously.
The input changes require a full rebuild for incremental task ':compileGroovy'.
Groovy compilation avoidance is an incubating feature.
Full recompilation is required because no incremental change information is available. This is usually caused by clean builds or changing compiler arguments.

I am using Gradle 7.3.3 ( latest version ), with open JDK 16

micronaut-cache-conflict.zip

@oehme
Copy link
Contributor

oehme commented Dec 30, 2021

This is a duplicate of #13766.

@nassimus26
Copy link
Author

@oehme I am not sure because when Micronaut is not implicated in the build, it seems working, but maybe the problem could also happening without Micronaut, in this case, yes it’s a duplicate

@oehme
Copy link
Contributor

oehme commented Dec 30, 2021

Ah sorry I misread the steps. You're right, this is not a duplicate. I'll have a look what's going on in this scenario.

@nassimus26
Copy link
Author

@oehme thanks, I hope it gonna be fixed soon

@nassimus26
Copy link
Author

nassimus26 commented Dec 30, 2021

@oehme I am not sure but it seems that when I cancel the build before it finish it leads to the same problem I think

@nassimus26
Copy link
Author

Any update about this issue ?!

@asodja
Copy link
Member

asodja commented Mar 19, 2022

This looks like an issue when compilation fails and we do a full recompilation after the failure. We plan to fix this, but due to other priorities it very likely won't be fixed in next two months.

@asodja
Copy link
Member

asodja commented Jun 7, 2022

The linked PR #20950 probably fixes this issue. The reproducer doesn't work with any of latest Gradle (7.3.3 or 7.4.2) so I can't test it (wrapper has version 5.6.4).

I think this is an issue with "full recompilation after the failure". So if no other reproducer is added that shows this is some different issue, this issue will be closed once #20950 gets merged. Of course you can always open a new issue.

@nassimus26
Copy link
Author

@asodja hi, this issue was opened 4months ago, you asked me to try with the last version, so I create a new issue with the last version, but now it’s not the last version anymore, but all you need to check if it fixed or not, is to change the version of gradle in the joined test project, otherwise each time I will create a new issue with the last version, then it had to wait to a new version then you will ask the same thing ….

@asodja
Copy link
Member

asodja commented Jun 7, 2022

I understand that it's not feasible for you to update Gradle version for me and that totally makes sense. The problem I am facing is, that when I try to reproduce the issue with the version specified in this issue (7.3.3) and reproducer linked in the issue: https://github.com/gradle/gradle/files/7791258/micronaut-cache-conflict.zip I get:

❯ ./gradlew :compileGroovy

FAILURE: Build failed with an exception.

* Where:
Build file '/path-to-project/micronaut-cache-conflict/build.gradle' line: 19

* What went wrong:
A problem occurred evaluating root project 'micronaut-cache-conflict'.
> Failed to apply plugin class 'nebula.plugin.extraconfigurations.ProvidedBasePlugin'.
   > No such property: COMPILE_CONFIGURATION_NAME for class: org.gradle.api.plugins.JavaPlugin

I also tried with version 7.0 and got the same problem. This indicates that the plugin that is used in the reproducer is not updated to work with 7.x.

So it seems to me that the reproducer was actually not run with Gradle 7.3.3.

@nassimus26
Copy link
Author

@asodja you are right, the project is misconfigured, my bad, you can close the issue, I will reopen it, if I found the time to fix it.
sorry for the error, thanks for your time.

@asodja
Copy link
Member

asodja commented Jun 7, 2022

Thanks for rechecking it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:bug in:annotation-processing processor annotation incremental isolated aggregating apt kapt
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants