'디플로이어'에 해당되는 글 1건

  1. 2008.03.05 [ANT] Tomcat Deployer를 이용해서 원격지서버에 Deploy하기 2
 

ANT라는 훌륭한 배포툴이 있었을 줄이야-_-;
그냥 Spring Framework 쎕바쎕~ 예제를 따라하다가 여기서 ant로 컴파일하고 배포하고 막 그르거든요^^
http://www.springframework.org/docs/Spring-MVC-step-by-step/index.html
이게 Spring MVC 스텝바이스텝 예제인데요. 여기서 ANT로 컴파일하고 해당 톰캣에 배포까지는 하는데요.
로컬에 있는 TOMCAT에서만 하고 실제 원격지에다가 deploy하는 법은 또 따로 있더라구요.

http://tomcat.apache.org/download-60.cgi
톰캣 다운로드 홈페이지를 가면, Core 랑 Deployer 2개가 있어요(Tomcat을 한 100번은 받아본 것 같은데 Deployer는 처음봐요-_-;)
Deployer를 받아야해요.

그런다음에 적당한 곳에 압축을 풀어봅시다.
저는 D:/apache-tomcat-6.0.16-deployer/ 이 경로에다가 풀었어요.

build.xml파일을 열어봅시다.
[code]
<property name="deployer.lib" value="D:/apache-tomcat-6.0.16-deployer/lib" />

<path id="deployer.classpath">
  <fileset dir="${deployer.lib}">
   <include name="*.jar"/>
  </fileset>
 </path>

<!-- Configure the custom Ant tasks for the Manager application -->
<taskdef resource="org/apache/catalina/ant/catalina.tasks"
     classpathref="deployer.classpath"/>
[/code]
요렇게 추가를 해봅시다. deployer에 있는 lib를 경로로 추가하는 것이 포인트입니다 ^^
그러면 <deploy>태그를 사용할 수 있더군요.
저것을 추가하지 않으면 이렇게 뜹니다.

D:\workspace\workspace_java\springapp\build.xml:76: Problem: failed to create task or type deploy
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.

그럼 <deploy>태그를 이용해서 원격지 서버에 배포할 수 있습니다.
[code]
<target name="server_deploy" depends="deploywar" description="server deploy">
  <deploy url="${tomcat.manager.url}"
   username="${tomcat.manager.username}"
   password="${tomcat.manager.password}"
   path="/${name}"
   war="file:${name}.war"
   update="true">
  </deploy>
 </target>
[/code]
자세히 보면 depends는 deploywar인데 이 target은 war로 만들어주는 target입니다. 저것을 먼저 실행한 후 war파일을 생성한 뒤 그 war파일을 해당 서버에 deploy하는 것이죠.
tomcat.manager.url은 http://서버아이피:8080/manager
tomcat.manager.username는 매니저id
tomcat.manager.password는 매니저password

tomcat에 매니저아이디를 추가하는 것은 (6.0기준)
{tomcat홈}/conf/tomcat-users.xml 파일을 수정해야합니다.
[code]
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
  <role rolename="manager"/>
  <user username="manager" password="manager1" roles="manager"/>
</tomcat-users>
[/code]
저렇게 추가를 하면 돼요.
 
Posted by 머드초보
,