-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQueryDsl.md
More file actions
75 lines (59 loc) · 1.6 KB
/
Copy pathQueryDsl.md
File metadata and controls
75 lines (59 loc) · 1.6 KB
Edit and raw actions
OlderNewer
1
---
2
layout : wiki
3
title : QueryDsl
4
summary : QueryDsl 설정 방법과 tip 들
5
date : 2018-12-30 18:41:09 +0900
6
updated : 2018-12-30 19:50:22 +0900
7
tags : jpa, querydsl
8
toc : true
9
public : true
10
parent : JPA
11
latex : false
12
adsense : true
13
---
14
* TOC
15
{:toc}
16
17
## Gradle 설정방법
18
19
* gradle plugin 추가
20
21
```
22
buildscript {
23
repositories {
24
maven {
25
url "https://plugins.gradle.org/m2/" }
26
}
27
dependencies {
28
classpath "gradle.plugin.com.ewerk.gradle.plugins:querydsl-plugin:1.0.10"
29
}
30
}
31
32
apply plugin: "com.ewerk.gradle.plugins.querydsl"
33
```
34
35
* querydsl 의 QEntity 생성 폴더 변경
36
37
```
38
compile "com.querydsl:querydsl-jpa:$queryDslVersion"
39
40
41
ext {
42
querydslSrcDir = 'src/main/generated'
43
}
44
45
46
querydsl {
47
library = "com.querydsl:querydsl-apt"
48
jpa = true
49
querydslSourcesDir = querydslSrcDir
50
}
51
52
sourceSets {
53
main {
54
java {
55
srcDirs += file(querydslSrcDir)
56
}
57
}
58
}
59
60
idea {
61
module {
62
generatedSourceDirs += file(querydslSrcDir) // just hint
63
}
64
}
65
```
66
67
## trouble shooting
68
69
* compileQueryDsl 단계에서 계속 annotation 들을 찾을수 없다면서 에러가 발생할때,
70
* 에러메시지: `error: package org.springframework.boot does not exist`
71
* 조치방법: 혹시 **Spring Initializr** 를 통해서 프로젝트를 생성했다면, `compile('org.springframework.boot:spring-boot-starter-data-jpa')`가 compile 이 아니고 `implementation` 으로 되어 있진 않은지 확인해 보길 바란다.
72
73
## 참고자료
74
75
* [com.ewerk.gradle.plugins.querydsl](https://plugins.gradle.org/plugin/com.ewerk.gradle.plugins.querydsl)