gradle 핫 리로드

merci·2023년 12월 27일
0

우선 gradle이 설치되어 있어야 합니다.

$ gradle -v

설치하는 방법은 여러방법이 있습니다.

$ choco install gradle

$ brew install gradle

설치가 되었다면

$ gradle -v

Welcome to Gradle 8.5!

Here are the highlights of this release:
 - Support for running on Java 21
 - Faster first use with Kotlin DSL
 - Improved error and warning messages

For more details see https://docs.gradle.org/8.5/release-notes.html


------------------------------------------------------------
Gradle 8.5
------------------------------------------------------------

Build time:   2023-11-29 14:08:57 UTC
Revision:     28aca86a7180baa17117e0e5ba01d8ea9feca598

Kotlin:       1.9.20
Groovy:       3.0.17
Ant:          Apache Ant(TM) version 1.10.13 compiled on January 4 2023
JVM:          11.0.20 (Oracle Corporation 11.0.20+9-LTS-256)
OS:           Windows 11 10.0 amd64

이제 프로젝트 디렉토리로 가서 아래 커맨드를 입력합니다.
t는 continue 옵션으로 수정사항을 반영해줍니다.

$ gradle bootRun -t

아래와 같은 오류가 나온다면 gradle wrapper를 새로 빌드합니다.

$ ./gradlew bootRun -t

Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain
Caused by: java.lang.ClassNotFoundException: org.gradle.wrapper.GradleWrapperMain

프로젝트 디렉토리의 gradle/wrapper/gradle-wrapper.properties 파일의 버전을 확인합니다.

확인한 버전으로 gradle wrapper를 새로 빌드합니다.

$ gradle wrapper --gradle-version 8.0.2

Starting a Gradle Daemon (subsequent builds will be faster)

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.5/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD SUCCESSFUL in 12s
1 actionable task: 1 executed

이제 continue 옵션을 넣어서 핫 리로드 기능을 사용합니다.

$ ./gradlew bootRun -t

Welcome to Gradle 8.0.2!

Here are the highlights of this release:
 - Improvements to the Kotlin DSL
 - Fine-grained parallelism from the first build with configuration cache
 - Configurable Gradle user home cache cleanup

For more details see https://docs.gradle.org/8.0.2/release-notes.html

Starting a Gradle Daemon, 1 incompatible and 15 stopped Daemons could not be reused, use --status for details
<-------------> 0% EXECUTING [5s]
...
  • 빌드시간 단축시키는 gradle 옵션
bootRun -t --parallel --build-cache --configuration-cache
profile
작은것부터

0개의 댓글