- 이클립스(sts)에서 메이븐을 이용하여 톰캣에 배포하기
환경
- sts 3.6
- maven 3.2
- tomcat7
1. Tomcat7 권한 설정
- tomcat/conf/tomcat-users.xml
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<user username="admin" password="password" roles="manager-gui,manager-script" />
</tomcat-users>
2. maven 권한 설정
- 사용자폴더/.m2/settings.xml
<?xml version="1.0" encoding="UTF-8"?>
<settings>
<servers>
<server>
<id>TomcatServer</id>
<username>id</username>
<password>password</password>
</server>
</servers>
</settings>
3. pom.xml plug-in 추가
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<url>http://localhost:8080/manager/text</url>
<server>TomcatServer</server>
<path>/path</path>
</configuration>
</plugin>
4. eclipse 프로젝트 우클릭 -> Run As -> 6.Maven Build ->
-> Goals란에 "clean install tomcat7:redeploy" 입력 후 Run
-> 이후에는 5.Maven Build 를 눌러서 가능
..
..
[INFO] <<< tomcat7-maven-plugin:2.2:redeploy (default-cli) @ web <<<
[INFO]
[INFO] --- tomcat7-maven-plugin:2.2:redeploy (default-cli) @ web ---
[INFO] Deploying war to http:///web
Uploading: http:///manager/text/deploy?path=%2Fweb&update=true
Uploaded: http:///manager/text/deploy?path=%2Fweb&update=true (4009 KB at 7070.5 KB/sec)
[INFO] tomcatManager status code:200, ReasonPhrase:OK
[INFO] OK - Deployed application at context path /web
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.336 s
[INFO] Finished at: 2014-12-06T01:15:43+09:00
[INFO] Final Memory: 21M/156M
[INFO] ------------------------------------------------------------------------
앞으로는 간단하게 이클립스(sts)에서 배포
'개발' 카테고리의 다른 글
[eclipse/tip] 파일찾기 중 특정폴더 제외하기 (0) | 2015.02.24 |
---|---|
[SPRING] java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext (0) | 2014.12.08 |
[Spring] STS를 이용한 maven 웹프로젝트 기본환경 구축 (0) | 2014.12.06 |
[BootStrap] 아이콘 색상 바꾸기 (0) | 2014.11.04 |
테이블 길이에 맞게 내용 맞추기 (0) | 2014.10.15 |