error: Unexpected error: Attempt to recreate a file for type com.example.$DemoTest$Definition

See original GitHub issue

Expected 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

  1. git clone git@github.com:natros/mn-demo.git
  2. ./gradlew --console=verbose testClasses
  3. gsed ‘s/“auth”/“auth2”/’ -i src/main/java/com/example/ApiConfiguration.java
  4. ./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:closed
  • Created 2 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
oehmecommented, Nov 22, 2021

Found and fixed that issue as well, same pull request.

2reactions
oehmecommented, Nov 19, 2021

@natros I’ve verified my fix with your sample. Can you check out https://github.com/gradle/gradle/pull/19067, run gradle install and let me know whether this fixes your real project?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found