IDE 에서 생성한 rebel.xml 이 프로젝트와 맞지 않아서 제대로 되지 않았는데, 이를 해결할 수 있는 방법을 찾았다.
build.gradle 에 아래 스크립트를 추가하면 war 태스크가 실행될 때 war 의존성을 걸어둔 generateRebel 가 호출되면서 build/resources/main 아래에reble.xml 이 생성된다. 프로젝트의 클래스패스와 웹경로의 항목들을 출력하는 특징을 가진다.
이 태스크가 실행되기 위해서는 프로젝트에 war 플러그인이 설치되어 있어야 한다.
apply plugin: 'war'
// 생략
task generateRebel << {def rebelFile = sourceSets.main.output.classesDir.absolutePath + '/rebel.xml'def srcWebApp = project.webAppDir.absolutePathdef writer = new FileWriter(rebelFile)new groovy.xml.MarkupBuilder(writer).application() {classpath{dir( name:sourceSets.main.output.classesDir.absolutePath )}web{link(target:'/'){dir(name:srcWebApp)}}}}war.dependsOn generateRebel
생성된
rebel.xml(1)(2)
| 컴파일된 클래스 핫스와핑 | |
| 변경된 설정파일 모니터링 |
'Tools > BuildTools' 카테고리의 다른 글
| [gradle] 5.0 RELEASE (1) | 2018.11.29 |
|---|---|
| [gradle] wrapper 버전 업그레이드 하기 (0) | 2017.03.24 |
| [gradle] 그레이들이 그루비를 떠나 코틀린으로 갈까? (0) | 2016.05.21 |
| WebJars 를 이용한 웹 라이브러리 의존성 관리 (3) | 2016.03.15 |
| [Gradle] 프로젝트 빌드시 gradle 에서 바라보는 JAVA_HOME 지정하기 (0) | 2016.03.03 |