728x90
반응형
그래들(gradle)로 스프링 부트 애플리케이션을 빌드하고 실행하는 방법입니다.
PC의 JDK 버전을 확인하고, build.gradle 파일에 버전을 맞춥니다.
명령 프롬프트(cmd.exe)를 실행하고, build.gradle 파일이 위치한 곳으로 이동합니다.
C:\Users\myanj> cd \java\eclipse-workspace\board
C:\java\eclipse-workspace\board> dir build.gradle
C 드라이브의 볼륨에는 이름이 없습니다.
볼륨 일련 번호: 8CBD-6679
C:\java\eclipse-workspace\board 디렉터리
2023-01-17 오후 05:48 1,315 build.gradle
1개 파일 1,315 바이트
0개 디렉터리 110,187,745,280 바이트 남음
gradlew.bat clean 명령으로 기존에 생성된 빌드 파일을 삭제합니다.
C:\java\eclipse-workspace\board> dir
C 드라이브의 볼륨에는 이름이 없습니다.
볼륨 일련 번호: 8CBD-6679
C:\java\eclipse-workspace\board 디렉터리
2023-01-17 오후 06:02 <DIR> .
2023-01-17 오후 06:02 <DIR> ..
2023-01-04 오후 04:28 1,104 .classpath
2023-01-02 오후 05:04 444 .gitignore
2023-01-17 오후 05:47 <DIR> .gradle
2023-01-02 오후 05:05 771 .project
2023-01-17 오후 05:46 <DIR> .settings
2023-01-03 오후 12:35 <DIR> bin
2023-01-17 오후 06:02 <DIR> build <<<< 삭제됨
2023-01-17 오후 05:48 1,315 build.gradle
2023-01-02 오후 05:04 <DIR> gradle
2023-01-02 오후 05:04 8,188 gradlew
2023-01-02 오후 05:04 2,838 gradlew.bat
2023-01-02 오후 05:04 1,992 HELP.md
2023-01-11 오후 01:00 2,156 README.md
2023-01-06 오전 10:13 191 settings.gradle
2023-01-02 오후 05:04 <DIR> src
9개 파일 18,999 바이트
8개 디렉터리 110,187,130,880 바이트 남음
C:\java\eclipse-workspace\board> gradlew.bat clean
BUILD SUCCESSFUL in 911ms
1 actionable task: 1 executed
C:\java\eclipse-workspace\board> dir
C 드라이브의 볼륨에는 이름이 없습니다.
볼륨 일련 번호: 8CBD-6679
C:\java\eclipse-workspace\board 디렉터리
2023-01-17 오후 06:02 <DIR> .
2023-01-17 오후 06:02 <DIR> ..
2023-01-04 오후 04:28 1,104 .classpath
2023-01-02 오후 05:04 444 .gitignore
2023-01-17 오후 05:47 <DIR> .gradle
2023-01-02 오후 05:05 771 .project
2023-01-17 오후 05:46 <DIR> .settings
2023-01-03 오후 12:35 <DIR> bin
2023-01-17 오후 05:48 1,315 build.gradle
2023-01-02 오후 05:04 <DIR> gradle
2023-01-02 오후 05:04 8,188 gradlew
2023-01-02 오후 05:04 2,838 gradlew.bat
2023-01-02 오후 05:04 1,992 HELP.md
2023-01-11 오후 01:00 2,156 README.md
2023-01-06 오전 10:13 191 settings.gradle
2023-01-02 오후 05:04 <DIR> src
9개 파일 18,999 바이트
7개 디렉터리 110,230,659,072 바이트 남음
gradlew.bat build 명령으로 배포 파일을 생성합니다.
C:\java\eclipse-workspace\board> gradlew.bat build
> Task :compileJava
warning: unknown enum constant When.MAYBE
reason: class file for javax.annotation.meta.When not found
warning: unknown enum constant When.MAYBE
reason: class file for javax.annotation.meta.When not found
warning: unknown enum constant When.MAYBE
reason: class file for javax.annotation.meta.When not found
warning: unknown enum constant When.MAYBE
reason: class file for javax.annotation.meta.When not found
warning: unknown enum constant When.MAYBE
reason: class file for javax.annotation.meta.When not found
Note: C:\java\eclipse-workspace\board\src\main\java\board\aop\TransactionAspect.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
5 warnings
BUILD SUCCESSFUL in 10s
7 actionable tasks: 7 executed
C:\java\eclipse-workspace\board> dir
C 드라이브의 볼륨에는 이름이 없습니다.
볼륨 일련 번호: 8CBD-6679
C:\java\eclipse-workspace\board 디렉터리
2023-01-17 오후 06:15 <DIR> .
2023-01-17 오후 06:15 <DIR> ..
2023-01-04 오후 04:28 1,104 .classpath
2023-01-02 오후 05:04 444 .gitignore
2023-01-17 오후 05:47 <DIR> .gradle
2023-01-02 오후 05:05 771 .project
2023-01-17 오후 05:46 <DIR> .settings
2023-01-03 오후 12:35 <DIR> bin
2023-01-17 오후 06:15 <DIR> build <<< 생성됨
2023-01-17 오후 05:48 1,315 build.gradle
2023-01-02 오후 05:04 <DIR> gradle
2023-01-02 오후 05:04 8,188 gradlew
2023-01-02 오후 05:04 2,838 gradlew.bat
2023-01-02 오후 05:04 1,992 HELP.md
2023-01-11 오후 01:00 2,156 README.md
2023-01-06 오전 10:13 191 settings.gradle
2023-01-02 오후 05:04 <DIR> src
9개 파일 18,999 바이트
8개 디렉터리 110,193,319,936 바이트 남음
build\libs 디렉터리 아래로 이동해서 jar 파일을 실행합니다.
C:\java\eclipse-workspace\board> cd build\libs
C:\java\eclipse-workspace\board\build\libs> dir
C 드라이브의 볼륨에는 이름이 없습니다.
볼륨 일련 번호: 8CBD-6679
C:\java\eclipse-workspace\board\build\libs 디렉터리
2023-01-17 오후 06:15 <DIR> .
2023-01-17 오후 06:15 <DIR> ..
2023-01-17 오후 06:15 288,445 board-0.0.1-SNAPSHOT-plain.jar
2023-01-17 오후 06:15 42,718,582 board-0.0.1-SNAPSHOT.jar
2개 파일 43,007,027 바이트
2개 디렉터리 110,192,631,808 바이트 남음
C:\java\eclipse-workspace\board\build\libs> java -jar board-0.0.1-SNAPSHOT.jar
18:17:04,738 |-INFO in ch.qos.logback.core.joran.spi.ConfigurationWatchList@d6e7bab - URL [jar:file:/C:/java/eclipse-workspace/board/build/libs/board-0.0.1-SNAPSHOT.jar!/BOOT-INF/classes!/logback-spring.xml] is not of type file
18:17:04,779 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
18:17:04,780 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [console]
18:17:04,785 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
18:17:04,801 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
18:17:04,801 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [console-infolog]
18:17:04,802 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
18:17:04,803 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [board] to DEBUG
18:17:04,804 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@693fe6c9 - Propagating DEBUG level on Logger[board] onto the JUL framework
18:17:04,805 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [jdbc.sqlonly] to INFO
18:17:04,805 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@693fe6c9 - Propagating INFO level on Logger[jdbc.sqlonly] onto the JUL framework
18:17:04,806 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [jdbc.resultsettable] to INFO
18:17:04,806 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@693fe6c9 - Propagating INFO level on Logger[jdbc.resultsettable] onto the JUL framework
18:17:04,807 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to OFF
18:17:04,807 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@693fe6c9 - Propagating OFF level on Logger[ROOT] onto the JUL framework
18:17:04,808 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [console] to Logger[ROOT]
18:17:04,808 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
18:17:04,809 |-INFO in org.springframework.boot.logging.logback.SpringBootJoranConfigurator@22e357dc - Registering current configuration as safe fallback point
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.7.8-SNAPSHOT)
2023-01-17 18:17:04,884 INFO [board.BoardApplication] Starting BoardApplication using Java 11.0.16.1 on DESKTOP-F4BC13L with PID 1140 (C:\java\eclipse-workspace\board\build\libs\board-0.0.1-SNAPSHOT.jar started by myanj in C:\java\eclipse-workspace\board\build\libs)
2023-01-17 18:17:04,885 DEBUG [board.BoardApplication] Running with Spring Boot v2.7.8-SNAPSHOT, Spring v5.3.25
2023-01-17 18:17:04,887 INFO [board.BoardApplication] No active profile set, falling back to 1 default profile: "default"
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
2023-01-17 18:17:06,059 INFO [jdbc.sqlonly] select 1
HikariDataSource (HikariPool-1)
2023-01-17 18:17:07,930 INFO [board.BoardApplication] Started BoardApplication in 3.466 seconds (JVM running for 3.839)
서비스 포트를 8080이 아닌 다른 포트를 사용할 경우 server.port 옵션을 사용합니다.
C:\java\eclipse-workspace\board\build\libs> java -jar board-0.0.1-SNAPSHOT.jar --server.port=9090
C:\java\eclipse-workspace\board\build\libs> java -Dserver.port=9090 -jar board-0.0.1-SNAPSHOT.jar
C:\java\eclipse-workspace\board\build\libs> java -jar board-0.0.1-SNAPSHOT.jar --server.port=9090
18:18:44,927 |-INFO in ch.qos.logback.core.joran.spi.ConfigurationWatchList@d6e7bab - URL [jar:file:/C:/java/eclipse-workspace/board/build/libs/board-0.0.1-SNAPSHOT.jar!/BOOT-INF/classes!/logback-spring.xml] is not of type file
18:18:44,966 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
18:18:44,966 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [console]
18:18:44,969 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
18:18:44,983 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
18:18:44,983 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [console-infolog]
18:18:44,984 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
18:18:44,985 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [board] to DEBUG
18:18:44,985 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@693fe6c9 - Propagating DEBUG level on Logger[board] onto the JUL framework
18:18:44,986 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [jdbc.sqlonly] to INFO
18:18:44,986 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@693fe6c9 - Propagating INFO level on Logger[jdbc.sqlonly] onto the JUL framework
18:18:44,987 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [jdbc.resultsettable] to INFO
18:18:44,987 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@693fe6c9 - Propagating INFO level on Logger[jdbc.resultsettable] onto the JUL framework
18:18:44,988 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to OFF
18:18:44,989 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@693fe6c9 - Propagating OFF level on Logger[ROOT] onto the JUL framework
18:18:44,990 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [console] to Logger[ROOT]
18:18:44,991 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
18:18:44,991 |-INFO in org.springframework.boot.logging.logback.SpringBootJoranConfigurator@22e357dc - Registering current configuration as safe fallback point
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.7.8-SNAPSHOT)
2023-01-17 18:18:45,063 INFO [board.BoardApplication] Starting BoardApplication using Java 11.0.16.1 on DESKTOP-F4BC13L with PID 14928 (C:\java\eclipse-workspace\board\build\libs\board-0.0.1-SNAPSHOT.jar started by myanj in C:\java\eclipse-workspace\board\build\libs)
2023-01-17 18:18:45,065 DEBUG [board.BoardApplication] Running with Spring Boot v2.7.8-SNAPSHOT, Spring v5.3.25
2023-01-17 18:18:45,067 INFO [board.BoardApplication] No active profile set, falling back to 1 default profile: "default"
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
2023-01-17 18:18:46,246 INFO [jdbc.sqlonly] select 1
HikariDataSource (HikariPool-1)
2023-01-17 18:18:48,138 INFO [board.BoardApplication] Started BoardApplication in 3.472 seconds (JVM running for 3.819)
C:\java\eclipse-workspace\board\build\libs> java -Dserver.port=9090 -jar board-0.0.1-SNAPSHOT.jar
18:19:37,441 |-INFO in ch.qos.logback.core.joran.spi.ConfigurationWatchList@d6e7bab - URL [jar:file:/C:/java/eclipse-workspace/board/build/libs/board-0.0.1-SNAPSHOT.jar!/BOOT-INF/classes!/logback-spring.xml] is not of type file
18:19:37,481 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
18:19:37,481 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [console]
18:19:37,484 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
18:19:37,499 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
18:19:37,499 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [console-infolog]
18:19:37,499 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
18:19:37,500 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [board] to DEBUG
18:19:37,500 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@693fe6c9 - Propagating DEBUG level on Logger[board] onto the JUL framework
18:19:37,501 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [jdbc.sqlonly] to INFO
18:19:37,501 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@693fe6c9 - Propagating INFO level on Logger[jdbc.sqlonly] onto the JUL framework
18:19:37,501 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [jdbc.resultsettable] to INFO
18:19:37,501 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@693fe6c9 - Propagating INFO level on Logger[jdbc.resultsettable] onto the JUL framework
18:19:37,502 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to OFF
18:19:37,502 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@693fe6c9 - Propagating OFF level on Logger[ROOT] onto the JUL framework
18:19:37,502 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [console] to Logger[ROOT]
18:19:37,502 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
18:19:37,503 |-INFO in org.springframework.boot.logging.logback.SpringBootJoranConfigurator@22e357dc - Registering current configuration as safe fallback point
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.7.8-SNAPSHOT)
2023-01-17 18:19:37,579 INFO [board.BoardApplication] Starting BoardApplication using Java 11.0.16.1 on DESKTOP-F4BC13L with PID 1932 (C:\java\eclipse-workspace\board\build\libs\board-0.0.1-SNAPSHOT.jar started by myanj in C:\java\eclipse-workspace\board\build\libs)
2023-01-17 18:19:37,580 DEBUG [board.BoardApplication] Running with Spring Boot v2.7.8-SNAPSHOT, Spring v5.3.25
2023-01-17 18:19:37,582 INFO [board.BoardApplication] No active profile set, falling back to 1 default profile: "default"
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
2023-01-17 18:19:38,731 INFO [jdbc.sqlonly] select 1
HikariDataSource (HikariPool-1)
2023-01-17 18:19:40,726 INFO [board.BoardApplication] Started BoardApplication in 3.543 seconds (JVM running for 3.9)
728x90
반응형
'개발' 카테고리의 다른 글
카카오 로그인 (0) | 2023.04.06 |
---|---|
네이버 로그인 (0) | 2023.04.06 |
EC2 인스턴스에 React + SpringBoot + MySQL 연동 (0) | 2023.03.29 |
폼 데이터와 함께 파일 업로드 (0) | 2023.02.21 |
Github Actions를 이용한 EC2 인스턴스로 스프링부트 애플리케이션 배포 (0) | 2022.10.25 |
댓글