■ Eclipse에서 Maven을 이용하여 간단한 Tomcat웹서버를 시작하는 예제이다.
■ Eclipse > File > New > Other를 선택한다.
■ Select a wizard에서 Maven > Maven Project를 선택한다.
■ Create a simple project(skip archetype selection)을 체크하고 Next 버튼을 클릭한다.
■ Group Id : net.iotinra, Artifact Id : pilot.simpletomcat을 입력하고 Packaging은 war을 선택하고 Finish버튼을 클릭한다.
■ 자동으로 생성된 pom.xml에 tomcat plugin을 추가한다. 톰캣 포트는 9900으로 설정했다.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>net.iotinfra</groupId> <artifactId>pilot.simpletomcat</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>war</packaging> <build> <finalName>${project.artifactId}</finalName> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.5</version> </plugin> <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.2</version> <configuration> <port>9900</port> <path>/</path> <contextReloadable>true</contextReloadable> <systemProperties> <JAVA_OPTS>-Xms512m -Xmx512m --XX:MaxPermSize=128m</JAVA_OPTS> </systemProperties> </configuration> </plugin> </plugins> </build> </project>
■ webapp디렉토리에 index.html을 아래와 같이 추가한다.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Simple Maven Tomcat</title> </head> <body> <h1>simple Maven Tomcat</h1> </body> </html>
■ webapp디렉토리에 WEB-INF디렉토리를 생성하고 web.xml파일을 아래와 같이 추가한다.
<?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <display-name>simpletomcat</display-name> <welcome-file-list> <welcome-file>index.html</welcome-file> </welcome-file-list> </web-app>
■ 최종적으로 생성된 디렉토리 구조는 아래와 같다.
■ Eclipse의 Package Explorer에서 simpletomcat프로젝트위에서 마우스 오른쪽 버튼을 클릭하고 Run As > Maven Build…를 선택한다.
■ Goals에서 clean tomcat7:run을 입력하고 Run버튼을 선택해서 tomcat서버를 시작한다.
■ 웹 브라우저에 http://localhost:9900을 입력하면 정상적으로 시작된 톰캣웹서버를 확인할 수 있다.(index.html)
- Tomcat : consider increasing the maximum size of the cache 2019년 3월 4일
- Tomcat Startup timeout error in Eclipse 2018년 5월 24일
- Tomcat 시작시 ServletContextListener를 통한 mySQL 접속 2018년 5월 8일
- spring mybatis mysql 연결 예제 2018년 5월 4일
- No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? 2017년 12월 4일
- maven filtering – 메이븐 필터링 2016년 10월 24일
- maven profiles – 개발/운영 환경별 빌드 2016년 10월 24일
- maven pom.xml에서 로그 출력하기 2016년 5월 30일
- ServletContextLister를 구현한 웹 애플리케이션 시작 시 작업 2016년 5월 2일
- org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 2016년 5월 2일
- JUnit Controller Test java.lang.NoClassDefFoundError: javax/servlet/SessionCookieConfig 2016년 3월 22일
- No grammar constraints (DTD or XML Schema) referenced in the document. 2016년 3월 21일
- Maven skipTests – Maven JUnit 테스트 안하기 2016년 3월 18일
- Eclipse Warnings – Attribute (cellpadding) is obsolete. Its use is discouraged in HTML5 documents. 2016년 3월 17일
- maven compile option -Xlint:deprecation 2016년 3월 17일
- Maven encoding 2016년 3월 17일
- TIBCO ActiveSpace Eclipse Maven 2016년 3월 16일
- java eclipse static import 2016년 3월 15일
- eclipse plugin 삭제 2016년 3월 14일
- Jetty Maven Plugin 2016년 3월 9일
- java.lang.UnsupportedClassVersionError: org/eclipse/jetty/maven/plugin/JettyRunMojo : Unsupported major.minor version 52.0 2016년 3월 9일
- Eclipse 단축키 2016년 3월 3일
- tomcat-maven-plugin을 통한 maven tomcat배포 2016년 2월 23일
- tomcat java.lang.OutOfMemoryError: PermGen space 2016년 2월 23일
- java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet 2016년 2월 19일
- Eclipse SVN 플러그인 설치 – Subversive 2016년 2월 17일
- Tomcat https 서비스(SSL, keystore) 2015년 7월 26일
- eclipse svn target ignore 2015년 7월 14일
- eclipse java.lang.OutOfMemoryError: PermGen space 2015년 7월 7일
- facet.IJ2EEFacetConstants error 2015년 1월 2일
- Eclipse Maven Conflict 2015년 1월 1일
- eclipse maven 디버그(debug) 모드로 빌드 2014년 11월 21일
- No Spring WebApplicationInitializer types detected on classpath 에러 2014년 11월 21일
- org.apache.ibatis.binding.BindingException 디버깅 2014년 11월 11일
- maven-war-plugin webXml, 개발 환경별 web.xml 관리 2014년 11월 10일
- Eclipse SVN plugin 설치 2014년 10월 3일
- tomcat7-maven-plugin 예제 2014년 10월 3일
- eclipse jdk변경(eclipse.ini) 2014년 10월 3일
- Eclipse Spring Maven 2014년 10월 3일
- Install Spring Tool Suite (STS) for Eclipse Luna (4.4) 3.6.1.RELEASE 2014년 10월 3일
- eclipse 실행시 heap size 늘리기(eclipse.ini) 2014년 10월 3일
- eclipse heap size 2014년 10월 3일
- 명령행 모드 메이븐 프로젝트 생성하기 2014년 9월 17일
- eclipse maven tomcat 자동 재시작 2014년 9월 13일