JPAAnnotationProcessor with classifier jakarta fails with "Attempt to recreate a file for type"
See original GitHub issueUsing querydsl 5.0.0, exact same setup in maven except one has no jakarta classifier and an 11 jvm, and the other adds the jakarta classifier and uses java 17. The java classifier plus java 17 version fails with “Attempt to recreate a file for type…”
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<classifier>jakarta</classifier>
<version>5.0.0</version>
</dependency>
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-jpa</artifactId>
<classifier>jakarta</classifier>
<version>5.0.0</version>
</dependency>
<plugin>
<groupId>com.mysema.maven</groupId>
<artifactId>apt-maven-plugin</artifactId>
<version>1.1.3</version>
<executions>
<execution>
<id>jpa</id>
<goals>
<goal>process</goal>
</goals>
<configuration>
<outputDirectory>target/generated-sources/java</outputDirectory>
<processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor>
</configuration>
</execution>>
</executions>
</plugin>
In the jvm 11 non-jakarta case the apt processor executes only during the generate-sources phase, in the jvm 17 jakarta case the apt processor also executes on the compilation phase…
[INFO] --- maven-compiler-plugin:3.10.1:compile (default-compile) @ smallmind-persistence ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 216 source files to C:\Users\david\Documents\Nutshell\empyrean\aeon\pantheon\org\smallmind\persistence\target\classes
Attempt to recreate a file for type org.smallmind.persistence.orm.jpa.QJPADurable
Attempt to recreate a file for type org.smallmind.persistence.orm.jpa.QTimestampedJPADurable
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] Attempt to recreate a file for type org.smallmind.persistence.orm.jpa.QJPADurable
[ERROR] Attempt to recreate a file for type org.smallmind.persistence.orm.jpa.QTimestampedJPADurable
[INFO] 2 errors
This happens even when I add…
<phase>generate-sources</phase>
I think this setup is pretty vanilla. Anyone else with this issue?
Issue Analytics
- State:
- Created 10 months ago
- Comments:8
Top Results From Across the Web
Attempt to recreate a file for type... · Issue #3580 · google/dagger
We are experiencing the follow issue occasionally: error: [Hilt] Attempt to recreate a file for type .OurApplication_GeneratedInjector: ...
Read more >JPA: Error: Attempt to recreate a file for type <MyClass>
java:43) [javac] Caused by: javax.annotation.processing.FilerException: Attempt to recreate a file for type domein.ClubLes_ [javac] at jdk.
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 >AnnotationProcessor Querydsl java.lang.NoClassDefFoundError
I tried with and without the gradle-apt-plugin. During compile time I got the following error. Caused by: java.lang.
Read more >[Spring JPA] QueryDsl와 Gradle 그리고 AnnotationProcessor
에러 메시지> package com.querydsl.core.types does not exist 수정 전 ... classifier: 'jpa' annotationProcessor("jakarta.persistence:jakarta.
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
The “jakarta”-variant of querydsl-apt provides a service declaration for javax.annotation.processing.Processor
Due to this, the Java compiler itself generates the Q-classes under target/generated-sources/annotation.
There are three possibilities to fix the error:
Having removed the maven plugin to avoid double generation of the Q sources, which does solve that problem btw, thank you, I was wondering if there was a way to alter the directory in which the Q sources are generated, sans plugin. This is not a huge deal as I can use the default annotations directory, but I was wondering.
By the way, my underlying problem is actually aspectj, which also runs annotation processing if you don’t shut it off, because you can never have too much of a good thing, and aspectj calls on the eclipse compiler, and the that calls into JDT, the eclipse tools, and throws a stack overflow exception trying to handle jakarta persistence annotations like MappedSuperclass.
https://github.com/eclipse-jdt/eclipse.jdt.core/issues/565
But all that is not a problem in the QueryDSL project, so I guess I can close this ticket. Thank you.