
์ด ๊ธ์์๋ ์คํ๋ง ํ๋ก์ ํธ ์์ฑ์ ๋ํด์ ๋ค๋ฃฐ๊ฒ์ด๋ฉฐ ํฐ๋ฏธ๋๋ก ์์ฑํ๋ ๋ฒ์ ๋ํด ๋ค๋ฃจ๋ ค๊ณ ํ๋ค.
Gradle์ ์ค์น & ํ๋ก์ ํธ ์ด๊ธฐํ
$ gradle init
ํ๋ก์ ํธ ๊ตฌ์กฐ์ด๋ค.
build build.gradle gradle gradlew gradlew.bat settings.gradle src
build.gradle์ ์์ฑํ๋ค.
plugins {
id 'org.springframework.boot' version '2.4.5'
id 'application'
id 'java'
}
version = '1.0.2'
group = 'com.pocript.Java'
java {
sourceCompatibility = JavaVersion.VERSION_1_8
}
repositories {
mavenCentral()
}
dependencies {
implementation platform('org.springframework.boot:spring-boot-dependencies:2.4.5')
implementation 'org.springframework.boot:spring-boot-starter-web'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
}
application {
mainClass = 'Java.App'
}
tasks.named('test', Test) {
useJUnitPlatform()
}
App.java
package Java;
import java.util.Arrays;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class App {
public static void main(String[] args) {
SpringApplication.run(App.class, args);
}
}
ํฐ๋ฏธ๋์ ./gradlew bootRun ์ ์ ๋ ฅํด์ ์คํํด๋ณธ๋ค.
> Task :compileJava
> Task :processResources NO-SOURCE
> Task :classes
> Task :bootRunMainClassName
> Task :bootRun
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.4.5)
2022-10-21 13:53:57.568 INFO 13748 --- [ main] Java.App : Starting App using Java 17-internal on localhost with PID 13748 (/data/data/com.termux/files/home/my/SPRING/Java/build/classes/java/main started by u0_a177 in /data/data/com.termux/files/home/my/SPRING/Java)
2022-10-21 13:53:57.580 INFO 13748 --- [ main] Java.App : No active profile set, falling back to default profiles: default
2022-10-21 13:53:59.973 INFO 13748 --- [ main] Java.App : Started App in 4.399 seconds (JVM running for 6.291)
BUILD SUCCESSFUL in 14s
์์ ๊ฐ์ด ๋จ๋ฉด ์ฑ๊ณต์ด๋ค.
๋ค์๋ฒ์๋ ๋ผ์ฐํ ์ ํด๋ณด๊ฒ ๋ค.