- Maven과 Spring으로 이것 저것 하던 도중, 기존작업하던 Spring MVC 프로젝트 구조에서 webapp폴더와 web.xml 파일 구조가 왜이렇게 나오는 걸까 호기심에 기존 maven으로 콘솔프로그램을 jar로 패키징하던 사이드 프로젝트를 war로 변경하였더니 아래와 같은 에러가 발생
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on project spring4ex: Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode) -> [Help 1]
- war 포맷이 기본 maven-war-plugin에 의해 패키징 될 때 기본적으로
프로젝트폴더/src/main/webapp/WEB-INF/web.xml
파일을 요구함을 확인할 수 있음 -
프로젝트폴더/src/main/webapp/WEB-INF/web.xml
파일을 내용 없이 만들었더니 war파일이 에러 없이 패키징됨 - war 파일이란?
- web.xml은 tomcat 설치디렉토리 안에 conf/web.xml 파일을 확인 해보면 각 프로젝트 내에 web.xml을 요구하는 것을 알 수 있다.