Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

907
Views
Problema de QueryDSL con gradle

Estoy usando QueryDSL con Lombok y gradle. Las clases Q se están generando, también IDEA puede verlas y no hay un error de compilación, pero cuando trato de ejecutar gradle build obtengo:

 error: cannot find symbol import QRole;

Por lo tanto, se generan archivos, pero la compilación de Gradle no puede verlos. Todas las soluciones que encontré no funcionan y, haga lo que haga, sigo recibiendo este error. Aquí está mi gradle.build:

 plugins { id 'org.springframework.boot' version '2.6.4' id 'io.spring.dependency-management' version '1.0.11.RELEASE' id 'java' id 'checkstyle' id 'org.sonarqube' version '3.3' id 'jacoco' id 'idea' id 'com.github.ben-manes.versions' version '0.42.0' } dependencies { // Annotation processors annotationProcessor group: 'org.projectlombok', name: 'lombok', version: lombokVersion testAnnotationProcessor group: 'org.projectlombok', name: 'lombok', version: lombokVersion // Mapstruct implementation group: 'org.mapstruct', name: 'mapstruct', version: mapstructVersion annotationProcessor group: 'org.mapstruct', name: 'mapstruct-processor', version: mapstructVersion annotationProcessor "org.springframework.boot:spring-boot-configuration-processor" annotationProcessor group: 'javax.annotation', name: 'javax.annotation-api', version: javaxAnnotationVersion annotationProcessor group: 'org.hibernate.javax.persistence', name: 'hibernate-jpa-2.2-api', version: jpaVersion annotationProcessor group: 'org.projectlombok', name: 'lombok', version: lombokVersion compileOnly group: 'org.projectlombok', name: 'lombok', version: lombokVersion testAnnotationProcessor group: 'org.projectlombok', name: 'lombok', version: lombokVersion annotationProcessor group: 'org.hibernate.javax.persistence', name: 'hibernate-jpa-2.2-api', version: jpaVersion annotationProcessor "org.springframework.boot:spring-boot-configuration-processor" implementation group: 'com.querydsl', name: 'querydsl-apt', version: querydslVersion implementation group: 'com.querydsl', name: 'querydsl-jpa', version: querydslVersion implementation group: 'com.querydsl', name: 'querydsl-sql', version: querydslVersion // Spring boot implementation group: 'org.springframework.boot', name: 'spring-boot-starter-actuator' implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web' implementation group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa' implementation group: 'org.springframework.boot', name: 'spring-boot-starter-webflux' implementation group: 'org.springframework.boot', name: 'spring-boot-starter-security' implementation group: 'org.springframework.boot', name: 'spring-boot-starter-validation' implementation group: 'org.springframework.retry', name: 'spring-retry', version: springRetry // Promotheus Monitoring (exposes /actuator/promotheus) runtimeOnly 'io.micrometer:micrometer-registry-prometheus' // Persistence runtimeOnly group: 'org.postgresql', name: 'postgresql', version: postgresVersion implementation group: 'org.flywaydb', name: 'flyway-core', version: flywayVersion implementation group: 'org.hibernate', name: 'hibernate-jcache', version: hibernateVersion implementation(group: 'org.hibernate', name: 'hibernate-spatial', version: hibernateVersion) { exclude group: 'org.postgresql', module: 'postgresql' } implementation group: 'com.vladmihalcea', name: 'hibernate-types-52', version: hibernateTypesVersion // Apache commons implementation group: 'org.apache.commons', name: 'commons-lang3', version: apacheCommonsLangVersion implementation group: 'org.apache.commons', name: 'commons-collections4', version: apacheCommonsCollectionVersion // Swagger implementation group: 'io.springfox', name: 'springfox-swagger2', version: swaggerVersion implementation group: 'io.springfox', name: 'springfox-swagger-ui', version: swaggerVersion // Jackson Datatype Jts implementation group: 'com.bedatadriven', name: 'jackson-datatype-jts', version: jacksonDatatypeJTSVersion // JWT implementation group: 'io.jsonwebtoken', name: 'jjwt', version: jjwtVersion // Logging dependencies runtimeOnly group: 'net.logstash.logback', name: 'logstash-logback-encoder', version: logstashVersion // Tests testImplementation(group: 'org.springframework.boot', name: 'spring-boot-starter-test') { exclude group: 'org.junit.vintage', module: 'junit-vintage-engine' } testImplementation group: 'org.springframework.security', name: 'spring-security-test' // Mockito testImplementation group: 'org.mockito', name: 'mockito-core', version: mockitoVersion testImplementation group: 'org.mockito', name: 'mockito-inline', version: mockitoVersion //JUnit testImplementation group: 'junit', name: 'junit', version: junitVersion //CSV implementation group: 'org.apache.commons', name: 'commons-csv', version: apacheCommonsCsvVersion // S3 implementation group: 'com.amazonaws', name: 'aws-java-sdk-s3', version: awsSdkVersion // SES implementation group: 'com.amazonaws', name: 'aws-java-sdk-ses', version: awsSdkVersion // AWS Secrets Manager implementation group: 'com.amazonaws', name: 'aws-java-sdk-secretsmanager', version: awsSdkVersion // RDS IAM access control implementation group: 'io.magj', name: 'iam-jdbc-driver', version: '0.1.8' // Scheduling implementation group: 'net.javacrumbs.shedlock', name: 'shedlock-spring', version: shedLockVersion implementation group: 'net.javacrumbs.shedlock', name: 'shedlock-provider-jdbc-template', version: shedLockVersion } dependencies { compileOnly "com.querydsl:querydsl-jpa:${querydslVersion}" compileOnly "org.projectlombok:lombok:${lombokVersion}" annotationProcessor( "com.querydsl:querydsl-apt:${querydslVersion}:jpa", "org.hibernate.javax.persistence:hibernate-jpa-2.1-api:${hibernateJPAVersion}", "javax.annotation:javax.annotation-api:${javaxAnnotationVersion}", "org.projectlombok:lombok" ) }
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Trabajar con Gradle, QueryDSL y Lombok juntos es un trabajo complicado, pero afortunadamente hay algunos complementos que lo hacen fácil. Aquí está el código que funciona.

 plugins { id 'org.springframework.boot' version '2.6.4' id 'io.spring.dependency-management' version '1.0.11.RELEASE' id 'java' id 'idea' id 'io.franzbecker.gradle-lombok' version '5.0.0' id 'com.ewerk.gradle.plugins.querydsl' version '1.0.10' } querydsl { library = 'com.querydsl:querydsl-apt:5.0.0' jpa = true } configurations { querydsl.extendsFrom implementation, compileClasspath } compileQuerydsl { options.annotationProcessorPath = configurations.querydsl } project.afterEvaluate { project.tasks.compileQuerydsl.options.compilerArgs = [ "-proc:only", "-processor", project.querydsl.processors() + ',lombok.launch.AnnotationProcessorHider$AnnotationProcessor' ] } sourceSets { main { java { srcDirs = ['src/main/java', 'src/querydsl/java'] } } } dependencies { implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'com.querydsl:querydsl-jpa:5.0.0' }

io.franzbecker.gradle-lombok y com.ewerk.gradle.plugins.querydsl son los complementos necesarios para que los 3 funcionen correctamente.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!