jenkins를 통해 톰켓의 2개의 서버에 배포를 해야되는 경우가 발생함
* maven settings.xml 파일에 servers 부분에 추가함
* maven pom.xml 수정
현재 배포 plugin은 다중 배포를 지원하지 않는것 같네.. 힘드네..
## 테스트한 plugin
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat6-maven-plugin</artifactId>
<version>2.1</version>
추후 테스트예정 plugin 들...
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.2.0</version>
테스트한거랑 같은건가...?? 모르겠네..
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>1.2-SNAPSHOT</version>
## 설정
a서버는 6.0.35
b서버는 6.0.37
* A서버 B서버 같은 설정
#vi $CATALINA_HOME/conf/tomcat-users.xml
<?xml version='1.0' encoding='utf-8'?> <tomcat-users> <role rolename="manager-gui"/> <role rolename="manager-script"/> <user username="tomcat" password="1234" roles="manager-gui, manager-script"/> </tomcat-users>
#vi $MAVEN_HOME/conf/settings.xml
<server> <id>aTomcat</id> <username>tomcat</username> <password>1234</password> </server> <server> <id>bTomcat</id> <username>tomcat</username> <password>1234</password> </server>
버전 6.0.35와 6.0.37 테스트시 url부분 때문에 문제가 발생함(403 Access Denied)
6.0.35는 /manager/html
6.0.37은 /manager 까지만... 중요!!!
.... <profiles> <profile> <id>aTomcat</id> <activation> <activeByDefault>true</activeByDefault> </activation> <properties> <tomcat-server>aTomcat</tomcat-server> <tomcat-url>http://xxx.xxx.xxx.xxx:9090/manager/html</tomcat-url> <tomcat-user>tomcat</tomcat-user> <tomcat-password>1234</tomcat-password> <tomcat-path>/</tomcat-path> </properties> </profile> <profile> <id>bTomcat</id> <properties> <tomcat-server>bTomcat</tomcat-server> <tomcat-url>http://xxx.xxx.xxx.xxx/manager</tomcat-url> <tomcat-user>tomcat</tomcat-user> <tomcat-password>1234</tomcat-password> <tomcat-path>/</tomcat-path> </properties> </profile> </profiles> .... <build> .... <pluginManagement> <plugins> .... <!-- 벤더사별 plugin Tomcat : http://tomcat.apache.org/maven-plugin-2.0/ Jobss : http://docs.jboss.org/jbossas/7/plugins/maven/7.4.Final/index.html Weblogic : http://docs.oracle.com/cd/E21764_01/web.1111/e13702/maven_deployer.htm WebSphere : http://www.jroller.com/peter_pilgrim/entry/battling_with_maven_2_integrating --> <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat6-maven-plugin</artifactId> <version>2.1</version> <configuration> <server>${tomcat-server}</server> <url>${tomcat-url}</url> <username>${tomcat-user}</username> <password>${tomcat-password}</password> <path>${tomcat-path}</path> <protocol>HTTP/1.1</protocol> <failOnError>false</failOnError> <charset>${encoding}</charset> <uriEncoding>${encoding}</uriEncoding> <update>true</update> <mode>war</mode> </configuration> </plugin> .... </plugins> </pluginManagement> .... </build> ....* maven 실행시 goals 갯수만큼 실행하던가 쉘스크립트로 만들던가 해야됨
플러그인 버전업시 지원 될라나..??
mvn -P aTomcat clean install tomcat6:stop tomcat6:undeploy tomcat6:deploy tomcat6:start
mvn -P bTomcat clean install tomcat6:stop tomcat6:undeploy tomcat6:deploy tomcat6:start
<plugin> .... <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> <version>1.6</version> <configuration> <target> <taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"/> <deploy url="http://xxx.xxx.xxx.xxx/manager" username="tomcat" password="1234" path="/" war="file:${project.build.directory}/${project.build.finalName}.${project.packaging}" update="true"/> <deploy url="http://xxx.xxx.xxx.xxx/manager" username="tomcat" password="1234" path="/" war="file:${project.build.directory}/${project.build.finalName}.${project.packaging}" update="true"/> </target> </configuration> .... </plugin>