error: Unexpected error: Attempt to recreate a file for type com.example.$DemoTest$Definition
See original GitHub issueExpected Behavior
Compile without errors
Actual Behaviour
> Task :compileJava
Note: Creating bean classes for 3 type elements
> Task :processResources UP-TO-DATE
> Task :classes
> Task :compileTestJava FAILED
Note: Creating bean classes for 1 type elements
error: Unexpected error: Attempt to recreate a file for type com.example.$DemoTest$Definition
1 error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileTestJava'.
> Compilation failed; see the compiler error output for details.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Steps To Reproduce
- git clone git@github.com:natros/mn-demo.git
- ./gradlew --console=verbose testClasses
- gsed ‘s/“auth”/“auth2”/’ -i src/main/java/com/example/ApiConfiguration.java
- ./gradlew --console=verbose testClasses
Environment Information
- macOS BigSur
- java --version openjdk 17.0.1 2021-10-19 LTS OpenJDK Runtime Environment Zulu17.30+15-CA (build 17.0.1+12-LTS) OpenJDK 64-Bit Server VM Zulu17.30+15-CA (build 17.0.1+12-LTS, mixed mode, sharing)
- gradle 7.3
Example Application
https://github.com/natros/mn-demo
Version
3.1.4
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Intermittent Unexpected error: Attempt to recreate a file for type ...
When Gradle incremental compilation is enabled the compilation intermittently fails with errors like: error: Unexpected error: Attempt to ...
Read more >JPA: Error: Attempt to recreate a file for type <MyClass>
This generated metamodel file contains the fields of the entity for you to reference in the criteria builder, for example.
Read more >Error:java: Attempt to recreate a file for type {QueryDsl classes}
When i run a test in Intellij, it throws the following error: Error:java: Attempt to recreate a file for type {QueryDsl classes}.
Read more >[METAGEN-36] Attempt to recreate a file for type
When genearting model from entities I got error. 1"error: Problem with Filer: Attempt to recreate a file for type ...." The problem looks...
Read more >308713 – Unable to compile project with JPA Entities ... - Bugs
Bug 308713 - Unable to compile project with JPA Entities and Eclipselink ... FilerException: Attempt to recreate a file for type ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Found and fixed that issue as well, same pull request.
@natros I’ve verified my fix with your sample. Can you check out https://github.com/gradle/gradle/pull/19067, run
gradle installand let me know whether this fixes your real project?