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

Gradle working example #357

Open
fab918 opened this issue Mar 25, 2024 · 4 comments
Open

Gradle working example #357

fab918 opened this issue Mar 25, 2024 · 4 comments

Comments

@fab918
Copy link

fab918 commented Mar 25, 2024

Hello,

I spent a few hours trying to get a project running with this version of QueryDSL. My project basically works with queryDsl v4. I'd like to update it, but I've tried everything I can't found on the Internet but and I can't get my Q classes generated with V5 and grandle. The examples on the repo are in Maven only unfortunately.

Is it possible to get help to have a minimal project that generates Q classes with Gradle?

I think it will help other people. Thanks for everything!

@DaiYuANg
Copy link

DaiYuANg commented Apr 3, 2024

Hey there, only add annotationProcessor in gradle

[versions]
queryDsl = "6.1"

[libraries]
#QueryDSL
queryDSLBom = { group = "io.github.openfeign.querydsl", name = "querydsl-bom", version.ref = "queryDsl" }
queryDslJPA = { group = "io.github.openfeign.querydsl", name = "querydsl-jpa", version.ref = "queryDsl" }
queryDslApt = { group = "io.github.openfeign.querydsl", name = "querydsl-apt", version.ref = "queryDsl" }
queryDslSpatial = { group = "io.github.openfeign.querydsl", name = "querydsl-spatial", version.ref = "queryDsl" }
queryDslGuava = { group = "io.github.openfeign.querydsl", name = "querydsl-guava", version.ref = "queryDsl" }
queryDslCollection = { group = "io.github.openfeign.querydsl", name = "querydsl-collections", version.ref = "queryDsl" }
queryDslCore = { group = "io.github.openfeign.querydsl", name = "querydsl-core", version.ref = "queryDsl" }
queryDslSql = { group = "io.github.openfeign.querydsl", name = "querydsl-sql", version.ref = "queryDsl" }
queryDslSqlCodeGen = { group = "io.github.openfeign.querydsl", name = "querydsl-codegen", version.ref = "queryDsl" }
compileOnly("io.github.openfeign.querydsl:querydsl-apt:${libs.versions.queryDsl.get()}:jpa")
implementation(libs.queryDslJPA)
annotationProcessor("io.github.openfeign.querydsl:querydsl-apt:${libs.versions.queryDsl.get()}:jpa")
implementation(libs.queryDslCore)
implementation(libs.queryDslGuava)
implementation(libs.queryDslCollection)
implementation(libs.queryDslSpatial)
annotationProcessor(libs.jakartaPersistence)

@velo
Copy link
Member

velo commented Apr 9, 2024

@fab918 we need to create a gradle plugin for querydsl.

But I never got to make one.

If you keen on making it happen, I'm more than happy to review and advise.

This might be a good inspiration
https://github.com/jOOQ/jOOQ/blob/main/jOOQ-codegen-gradle/src/main/java/org/jooq/codegen/gradle/NamedConfiguration.java

@fab918
Copy link
Author

fab918 commented Apr 29, 2024

@DaiYuANg It doesn't work, nothing happens when I run a build with gradle, normally the classes should be generated.

I tried :

compileOnly("io.github.openfeign.querydsl:querydsl-apt:6.2.1:jpa")
annotationProcessor("io.github.openfeign.querydsl:querydsl-apt:6.2.1:jpa")

I've tried the suggested configuration here querydsl/querydsl#3655, in the same way, nothing happens when I build.

I tested with java 17 and 21.

  implementation("io.github.openfeign.querydsl:querydsl-core:6.2.1")
  implementation("io.github.openfeign.querydsl:querydsl-jpa:6.2.1")
  annotationProcessor("io.github.openfeign.querydsl:querydsl-apt:6.2.1:jpa")
  annotationProcessor("jakarta.persistence:jakarta.persistence-api")
  annotationProcessor("jakarta.annotation:jakarta.annotation-api")

@velo Why should we need a plugin to use the library on Gradle?

@vidakovic
Copy link
Contributor

@fab918 ... I am using:

annotationProcessor "com.infobip:infobip-spring-data-jdbc-annotation-processor"

Note: the latest version 9.0.7 is not compatible, but I've created a PR to move all dependencies from "com.querydsl:" to "io.github.openfeign.querydsl:" infobip/infobip-spring-data-querydsl#101.

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

4 participants