메이븐 웹 프로젝트 tomcat 배포

메이븐 웹 프로젝트 tomcat 배포

  1. 이클립스 톰캣 서버 위치 변경
  2. 톰캣 서버 사용자 추가 C:\Program Files\Apache Software Foundation\Tomcat 8.0\conf\tomcat-users.xml
    <?xml version='1.0' encoding='cp949'?>
    <tomcat-users xmlns="http://tomcat.apache.org/xml"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
                  version="1.0">
     <role rolename="manager-script"/>
     <user username="admin" password="admin" roles="manager-script"/>
    </tomcat-users>
    role 과 사용자를 추가 하였다.
  3. maven-war-plugin , tomcat-maven-plugin 추가 및 설정
    추가 한 부분은 build node 아래 plugins 노드에 있다.
    <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/maven-v4_0_0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <groupId>com.dangun</groupId>
      <artifactId>boot</artifactId>
      <packaging>war</packaging>
      <version>0.0.1-SNAPSHOT</version>
      <name>boot Maven Webapp</name>
      <url>http://maven.apache.org</url>
      <dependencies>
        <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>3.8.1</version>
          <scope>test</scope>
        </dependency>
      </dependencies>
      <build>
        <finalName>boot</finalName>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.1.1</version>
            <configuration>
        <warSourceDirectory>src/main/webapp</warSourceDirectory>
        <webXml>src/main/webapp/WEB-INF/web.xml</webXml>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>tomcat-maven-plugin</artifactId>
            <version>1.1</version>
            <configuration>
        <url>http://127.0.0.1:8080/manager/text</url>
        <path>/</path>
        <charset>UTF-8</charset>
        <mode>war</mode>
        <username>admin</username>
        <password>admin</password>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </project>

  4. 이클립스의 서버 에서 톰캣을 더블클릭 후 Server Location을 use Tomcat installation 으로 변경
  5. 커맨드 창에서 입력 하거나 이클립스 Run As maven > mvn tomcat:deploy
  6. mvn tomcat:redeploy

댓글