[Spring] Spring boot jar build and run.

ITWeb/개발일반 2020. 6. 1. 18:05

build.gradle)
plugins {
  id 'org.springframework.boot' version '2.3.0.RELEASE'
...중략...
  id 'java'
  id 'war'
}

...중략...

task projectVersion {
  doLast {
    println "${project.version}"
  }
}

task jarName {
  doLast {
    println "${archivesBaseName}-${version}.jar"
  }
}

bootJar {
  archivesBaseName = "springboot-was"
}

war {
  enabled = true
  archivesBaseName = "springboot-was"
}

 

build)
$ ./gradlew clean build bootJar

 

run)
$ sudo java -Djava.security.egd=file:/dev/./urandom -jar springboot-was.jar

 

springboot 프로젝트로 빌드 후 embedded tomcat 으로 실행 하는 예제 입니다.

: