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

Q classes not generated with Java 21 #3655

Open
onacit opened this issue Dec 27, 2023 · 7 comments
Open

Q classes not generated with Java 21 #3655

onacit opened this issue Dec 27, 2023 · 7 comments
Labels

Comments

@onacit
Copy link

onacit commented Dec 27, 2023

No classes generated with Java21

With following dependencies, with Spring Boot 3.1.7.

+--- com.querydsl:querydsl-apt:5.0.0
|    \--- com.querydsl:querydsl-codegen:5.0.0
|         +--- com.querydsl:querydsl-core:5.0.0
|         |    \--- com.mysema.commons:mysema-commons-lang:0.2.4
|         +--- com.querydsl:codegen-utils:5.0.0
|         |    +--- org.eclipse.jdt:ecj:3.26.0
|         |    \--- io.github.classgraph:classgraph:4.8.108
|         +--- javax.inject:javax.inject:1
|         \--- io.github.classgraph:classgraph:4.8.108
java {
    sourceCompatibility = '17'
//    sourceCompatibility = '21'
}
dependencies {
    annotationProcessor "com.querydsl:querydsl-apt:${dependencyManagement.importedProperties['querydsl.version']}:jakarta"
    implementation "com.querydsl:querydsl-jpa:${dependencyManagement.importedProperties['querydsl.version']}:jakarta"
    annotationProcessor "jakarta.persistence:jakarta.persistence-api" // 이게 없으면 compile-time error
}

Q classes are generated along with JPA static metamodels

$ JAVA_HOME=$JAVA_HOME17 javac --version
javac 17.0.9
$ JAVA_HOME=$JAVA_HOME17 clean build

But following configuration and command does not generate Q classes, but only JPA static metamodels.

java {
//    sourceCompatibility = '17'
    sourceCompatibility = '21'
}
$ JAVA_HOME=$JAVA_HOME21 javac --version
javac 21.0.1
$ JAVA_HOME=$JAVA_HOME21 clean build
@onacit onacit added the bug label Dec 27, 2023
@temanskyM
Copy link

Add <classifier>jakarta</classifier> to your querydsl dependencies in pom.

@onacit
Copy link
Author

onacit commented Dec 28, 2023

@temanskyM I don't use Maven, and I did use jakarta classifiers as you can see.

@MarkJeong1
Copy link

@temanskyM

	implementation 'com.querydsl:querydsl-core:5.0.0'
	implementation 'com.querydsl:querydsl-jpa:5.0.0:jakarta'
	annotationProcessor(
			"jakarta.persistence:jakarta.persistence-api",
			"jakarta.annotation:jakarta.annotation-api",
			"com.querydsl:querydsl-apt:5.0.0:jakarta")

like this? but still not work for me.

@velo
Copy link
Contributor

velo commented Jan 4, 2024

@MarkJeong1 @onacit try to use my fork instead.

Just change group id to io.github.openfeign.querydsl, version to 6.0.0.M3 and drop jakarta classifier.

It should work, as Java 21 is part of the build on my fork
https://github.com/OpenFeign/querydsl

But, please let me know if it doesn't, I'm more than happy to fix it.

@celcius112
Copy link

celcius112 commented Jan 26, 2024

For those trying to use OpenFeign's fork with Gradle, these are the necessary dependencies:

  val queryDslVersion = "6.0"
  implementation("io.github.openfeign.querydsl:querydsl-core:$queryDslVersion")
  implementation("io.github.openfeign.querydsl:querydsl-jpa:$queryDslVersion")
  annotationProcessor("io.github.openfeign.querydsl:querydsl-apt:$queryDslVersion:jpa")
  annotationProcessor("jakarta.persistence:jakarta.persistence-api")
  annotationProcessor("jakarta.annotation:jakarta.annotation-api")

@velo
Copy link
Contributor

velo commented Jan 26, 2024

@celcius112 I'm starting to make a Gradle plugin for querydsl, if you keen to alpha test it, let me know

@celcius112
Copy link

celcius112 commented Jan 29, 2024

@velo why not :) feel free to ping me on the related "issue" if you require my help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants