써먹는 웹개발

[Jpa] intellij > gradle 환경에서 Q Class 생성 안되었을때 해결방법 본문

웹개발/Jpa

[Jpa] intellij > gradle 환경에서 Q Class 생성 안되었을때 해결방법

kmhan 2021. 12. 3. 18:05


728x90
반응형

해결방법

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
plugins {
    id 'org.springframework.boot' version '2.6.0'
    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
    id 'java'
    id "com.ewerk.gradle.plugins.querydsl" version "1.0.10"
}
 
...
 
dependencies {
    ...
 
    implementation 'com.querydsl:querydsl-jpa'
    implementation 'com.querydsl:querydsl-apt'
}
 
test {
    ...
}
 
// intellij
 
configurations {
    compileOnly {
        extendsFrom annotationProcessor
    }
    querydsl.extendsFrom compileClasspath
}
 
def querydslDirectory = "src/main/generated"
 
querydsl {
    library = "com.querydsl:querydsl-apt"
    jpa = true
    querydslDefault = true
    querydslSourcesDir = querydslDirectory
}
 
compileQuerydsl {
    options.annotationProcessorPath = configurations.querydsl
}
 
sourceSets {
    main.java.srcDir querydslDirectory
}
 
// compileQuerydsl.doFirst 추가
compileQuerydsl.doFirst {
    if ( file(querydslDirectory) )
        delete(file(querydslDirectory))
}
 
tasks.withType(JavaCompile) {
    options.generatedSourceOutputDirectory = file(querydslDirectory)
}
clean.doLast {
    delete file(querydslDirectory)
}
cs

 

참고 : https://velog.io/@dreamh1123/Querydsl-setting-in-intellij

728x90
반응형


Comments