스프링 부트 WAR 파일로 톰켓에 배포 과정.
1. pom.xml 변경
war 로 변경
<packaging>war</packaging>
추가
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
참고사이트
구글링 검색 =>
spring boot war deploy tomcat
https://spring.io/guides/gs/convert-jar-to-war/
2. MyWebInitializer
다음 과 같은 형태의 클래스를 추가해야 지만 스프링부트에서 war 배포시 초기화 과정을 통해 war 가 배포 된다.
package net.slipp;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
public class MyWebInitializer extends SpringBootServletInitializer{
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(DemoApplication.class);
}
}
class DemoApplication
package net.slipp;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
http://braverokmc.dothome.co.kr/m01/spring/view/850
리눅스
ip 주소가 아닌 서버 이름으로 변경
C:\Windows\System32\drivers\etc
hosts
192.168.111.128 demo2 |
cyj@cjh-PC MINGW64 ~
$ ssh root@demo2
The authenticity of host 'demo2 (192.168.111.128)' can't be established.
ECDSA key fingerprint is SHA256:K0Ct6qIMzHI93vl0il4VwOHf+VLtILpDPA9RDriJ/YY.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'demo2' (ECDSA) to the list of known hosts.
root@demo2's password:
Last login: Mon Jul 24 05:02:12 2017
[root@localhost ~]# ls
*** 리눅스 ***
실행중인 서버 킬
# ps -ef | grep java
# kill -9 5922??
# ps -ef | grep java
http://tomcat.apache.org/download-80.cgi
--
스프링부트에 내장된 톰켓 사용이 아니라 외부의
톰켓 다운로드
# wget http://apache.mirror.cdnetworks.com/tomcat/tomcat-8/v8.5.16/bin/apache-tomcat-8.5.16.tar.gz
** 압축 한번에 풀기 **
# tar -xvf apache-tomcat-8.5.5.tar.gz
** git 가져오기 **
# git pull
** 메이븐 빌드
./mvnw clean package
root@localhost ~]# ps -ef |grep java
root 5905 5492 0 07:45 pts/0 00:00:00 grep --color=auto java
[root@localhost ~]#
[root@localhost centos]# ls apache-tomcat-8.5.16 apache-tomcat-8.5.16.tar.gz spring_boot_demo2 vieditor [root@localhost centos]# cd spring_boot_demo2/ [root@localhost spring_boot_demo2]# ls README.md WebContent mvnw mvnw.cmd mvnw_notebook mvnw_pc pom.xml src [root@localhost spring_boot_demo2]# chmod 777 mvnw [root@localhost spring_boot_demo2]# ls -al 합계 44 drwxr-xr-x. 6 root root 173 Jul 27 08:16 . drwx------. 6 centos centos 182 Jul 27 08:16 .. drwxr-xr-x. 8 root root 163 Jul 27 08:16 .git -rw-r--r--. 1 root root 249 Jul 27 08:16 .gitignore drwxr-xr-x. 3 root root 21 Jul 27 08:16 .mvn -rw-r--r--. 1 root root 19 Jul 27 08:16 README.md drwxr-xr-x. 3 root root 22 Jul 27 08:16 WebContent -rwxrwxrwx. 1 root root 6468 Jul 27 08:16 mvnw -rw-r--r--. 1 root root 4994 Jul 27 08:16 mvnw.cmd -rw-r--r--. 1 root root 6468 Jul 27 08:16 mvnw_notebook -rw-r--r--. 1 root root 6468 Jul 27 08:16 mvnw_pc -rw-r--r--. 1 root root 2538 Jul 27 08:16 pom.xml drwxr-xr-x. 4 root root 30 Jul 27 08:16 src [root@localhost spring_boot_demo2]# ./mvnw clean package |
댓글 ( 4)
댓글 남기기