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

java build failed :The import javax.annotation.processing.Generated cannot be resolved #2799

Closed
magicsong opened this issue Nov 14, 2022 · 2 comments

Comments

@magicsong
Copy link

magicsong commented Nov 14, 2022

[provide a description of the issue]
my project(target version JDK8) using querydsl which use code-generation, it is OK using jdk8 to build and run. however vscode-java using higher jdk to build project(which will also regenerate the code), the generate code has wrong import "javax.annotation.proccessing.Generated" instead of "javax.annotation.Generated"(right one). As a result, java test cannot run the project in vscode.

Environment
  • Operating System: MACOS
  • JDK version: jdk-17.0.1.jdk/
  • Visual Studio Code version:
  • Java extension version: v1.12.0
Steps To Reproduce
  1. [step 1] use latest spring data
  2. [step 2] use querydsl

[Please attach a sample project reproducing the error]
Please attach logs

can i parse args to build like "--release 8"

@snjeza
Copy link
Contributor

snjeza commented Nov 14, 2022

@magicsong you can try to add

<options>
    <querydsl.generatedAnnotationClass>javax.annotation.Generated</querydsl.generatedAnnotationClass>
</options>

to apt-maven-plugin. For example,

<plugin>
    <groupId>com.mysema.maven</groupId>
    <artifactId>apt-maven-plugin</artifactId>
    <version>1.1.3</version>
    <executions>
        <execution>
            <goals>
                <goal>process</goal>
            </goals>
            <configuration>
                <outputDirectory>target/generated-sources/java</outputDirectory>
                <processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor>
                <options>
		    <querydsl.generatedAnnotationClass>javax.annotation.Generated</querydsl.generatedAnnotationClass>
	        </options>
            </configuration>
        </execution>
   </executions>
</plugin>

See http://querydsl.com/static/querydsl/latest/reference/html/ch03s03.html

@magicsong
Copy link
Author

@snjeza yeah, it works! thanks !

gregor77kr added a commit to Mwav-Corp/mwav-template that referenced this issue Jun 17, 2023
Resolve Qclass recognization error(javax.annotation.Generated not resolved type)
See also: redhat-developer/vscode-java#2799
Resolve maven compile failure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants