일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- WebJar
- 토익
- docker #docker tutorial
- Spring Boot
- 프로젝트 시작
- bootstrap
- 년말
- 평가인증
- #정규표현식
- #화면캡쳐 #macOS
- #Gradle Multi project with IntelliJ
- 감사
- 분석 작업
- jv
- #Microservice
- java
- Lambda
- Microservices
- 2010
- 방법론
- #단축키
- Today
- Total
사랑해 마니마니
gradle java project 만들기 본문
그래들 설치 확인
$ gradle -v
그래들 task 확인
$ gradle tasks
project 폴더 생성
$ _project_name_
java project 생성
$ gradle init --type java-library
gradle java 프로젝트 생성결과
$ tree
빌드
$ gradle build
. unmappable character for encoding MS949 오류 발생시
> 시스템 환경변수에
변수이름(N): GRADLE_OPTS
변수값(V):-Dfile.encoding=UTF-8
을 추가
빌드 결과 확인
$ tree /F
빌드 결과 삭제
$ gradle clean
gradle 테스트
$ gradle test
----------------------------------
build.gradle
apply plugin: 'java'
def defaultEncoding = 'UTF8'
sourceCompatibility = 1.8
targetCompatibility = 1.8
tasks.withType(JavaCompile) {
options.encoding = defaultEncoding
}
repositories {
mavenCentral()
}
dependencies {
testCompile "junit:junit:4.11"
}
#jar 파일명 설정: ${baseName}-${appendix}-${version}-${classifier}.jar
jar {
baseName = 'example'
appendix = 'bin'
version = '0.1'
classifier = 'jdk18'
}
1. Workspace에 폴더 만들기 (workspace 변경은 File > Switch workspace)
2. gradle init --type java-library
3. build.gradle 편집
https://github.com/spring-guides/gs-spring-boot/blob/master/complete/build.gradle 참고
4. gradle check
5. gradle initProject < 오류남.. T.T
6. gradle eclipse
7. sts에서 import > Browse > Build Model
<textarea name="code" class="brush:Groovy;">
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'io.spring.gradle:dependency-management-plugin:0.5.4.RELEASE'
}
}
apply plugin: 'java'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'eclipse'
dependencyManagement {
imports {
mavenBom 'io.spring.platform:platform-bom:2.0.1.RELEASE'
}
}
repositories {
jcenter()
}
targetCompatibility = 1.8
sourceCompatibility = 1.8
dependencies {
compile ('org.springframework.boot:spring-boot-starter-batch')
compile ('org.hsqldb:hsqldb')
testCompile ('junit:junit')
compile ('org.springframework.boot:spring-boot-devtools')
compile ('org.springframework.boot:spring-boot-starter-thymeleaf')
testCompile ('org.springframework.boot:spring-boot-starter-test')
}
</textarea>