728x90
스프링부트 프로젝트 war 파일 내보내기
1. war 파일이란?
** war ?
웹 애플리케이션의 압축파일
** jar ?
java 클래스 파일+라이브러리+메타데이터 압축파일
2. pom.xml 설정
packaging 태그 추가
<packaging>war</packaging>
pom.xml 파일 상단에 추가해주었다.
728x90
의존성 추가
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
톰캣 의존성 추가해주기
3. application.java 수정
SpringBootServletInitializer 상속 추가
@SpringBootApplication
public class projectApplication extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(projectApplication.class, args);
}
}
extends SpringBootServletInitializer 추가했다
@Override 추가
@SpringBootApplication
public class projectApplication extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(projectApplication.class);
}
public static void main(String[] args) {
SpringApplication.run(projectApplication.class, args);
}
}
4. war 파일 생성
프로젝트에서 마우스 우클릭
Run As ▶ 5 Maven build...
Goals : package 입력
Profiles : pom.xml 삭제
이후에 하단 Run 버튼 누르면 콘솔창에
BUILD SUCCESS 라고 뜬다
5. war 파일 위치
빌드 시 콘솔창 Building war : 에 war 위치 경로가 뜬다
해당 경로에 들어가보면
war 파일이 생성되어있다!!
300x250
'CODING > 🍃Spring & Spring Boot' 카테고리의 다른 글
[Spring boot] 스프링부트에서 commandMap 사용하기 (0) | 2024.02.19 |
---|---|
[Spring boot] jsonView.jsp not found, jsonView 리턴 안될 때 (0) | 2024.02.13 |
[Spring] DB 엑셀 다운로드 기능 구현하기 (0) | 2024.01.22 |
[Spring boot] 스프링부트 환경설정하기 (0) | 2024.01.11 |
[Spring] 다중 데이터베이스 사용하기 (1) | 2023.12.27 |