#spring #spring-boot #querydsl
#весна #пружинный ботинок #querydsl #весенняя загрузка
Вопрос:
Привет всем, у меня есть одна небольшая проблема с моим bulid.gradle я запущу свой проект, но это невозможно. У кого-нибудь есть идея, почему это может быть? Я получаю эту ошибку:
Не удалось выполнить задачу ‘:compileQuerydsl’. > Процессор аннотаций » не найден
- Попробуйте: запустите с параметром —stacktrace, чтобы получить трассировку стека. Запустите с параметром —info или —debug, чтобы получить больше выходных данных журнала. Запустите команду —scan, чтобы получить полную информацию.
Это моя конфигурация bulid.gradle
buildscript {
ext {
springBootVersion = '2.3.1.RELEASE'
queryDslVersion = '4.2.1'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath 'org.liquibase:liquibase-core:3.4.1'
classpath "org.liquibase:liquibase-gradle-plugin:1.1.1"
}
}
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "gradle.plugin.com.ewerk.gradle.plugins:querydsl-plugin:1.0.10"
}
}
plugins {
id 'org.springframework.boot' version '2.3.1.RELEASE'
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
id 'java'
id "com.ewerk.gradle.plugins.querydsl" version "1.0.10"
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
repositories {
mavenCentral()
}
dependencies {
compileOnly 'org.projectlombok:lombok:1.18.12'
annotationProcessor 'org.projectlombok:lombok:1.18.12'
testCompileOnly 'org.projectlombok:lombok:1.18.12'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.12'
compile group: 'org.hibernate', name: 'hibernate-validator', version: '6.1.5.Final'
// QueryDSL
compile "com.querydsl:querydsl-sql:${queryDslVersion}"
compile("com.querydsl:querydsl-core:${queryDslVersion}")
compileOnly "com.querydsl:querydsl-jpa:${queryDslVersion}"
/* TEST */
// Querydsl
testCompile "com.querydsl:querydsl-sql:${queryDslVersion}"
testAnnotationProcessor("com.querydsl:querydsl-apt:${queryDslVersion}:general")
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.liquibase:liquibase-core'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
runtimeOnly 'org.postgresql:postgresql'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
}
apply plugin: 'liquibase'
apply plugin: "com.ewerk.gradle.plugins.querydsl"
test {
useJUnitPlatform()
}
Комментарии:
1. Проверьте github.com/ewerk/gradle-plugins/issues/108 Добавьте в свой build.gradle: compileQuerydsl { options.annotationProcessorPath = конфигурации. querydsl }
Ответ №1:
я обнаружил эту проблему. Это верно:
buildscript {
ext {
springBootVersion = '2.3.1.RELEASE'
queryDslVersion = "4.2.1"
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath 'org.liquibase:liquibase-core:3.4.1'
classpath "org.liquibase:liquibase-gradle-plugin:1.1.1"
classpath "gradle.plugin.com.ewerk.gradle.plugins:querydsl-plugin:1.0.9"
classpath('net.ltgt.gradle:gradle-apt-plugin:0.18')
}
}
plugins {
id 'org.springframework.boot' version '2.3.1.RELEASE'
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
id "com.ewerk.gradle.plugins.querydsl" version "1.0.10"
id 'java'
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
repositories {
mavenCentral()
}
dependencies {
//Lombok
compileOnly 'org.projectlombok:lombok:1.18.12'
annotationProcessor 'org.projectlombok:lombok:1.18.12'
//Hibernate
compile group: 'org.hibernate', name: 'hibernate-validator', version: '6.1.5.Final'
// QueryDSL
compile("com.querydsl:querydsl-jpa:${queryDslVersion}",
"com.querydsl:querydsl-apt:${queryDslVersion}:jpa",
"com.querydsl:querydsl-core:${queryDslVersion}")
//Joda time
compile 'joda-time:joda-time:2.9.4'
//SpringBoot
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-web'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
runtimeOnly 'org.postgresql:postgresql'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
implementation 'org.liquibase:liquibase-core'
}
apply plugin: 'liquibase'
apply plugin: 'com.ewerk.gradle.plugins.querydsl'
def queryDslSourceDirectory = 'src/querydsl/java/generated'
test {
useJUnitPlatform()
}
querydsl {
jpa = true
querydslSourcesDir = queryDslSourceDirectory
}
sourceSets {
main {
java {
srcDir queryDslSourceDirectory
}
}
}
compileQuerydsl {
options.annotationProcessorPath = configurations.querydsl
}
configurations {
querydsl.extendsFrom compileClasspath
}