maven cargo 插件自动部署web项目到tomcat

maven cargo 插件自动部署web项目到tomcat

1、新建maven项目,archetype 选择 maven-archetype-webapp。
2、在maven项目中添加依赖

<dependency>
    <groupId>javax.servletgroupId>
    <artifactId>servlet-apiartifactId>
    <version>2.5version>
    <scope>providedscope>
dependency>

这样可以防止jsp页面开头报如下错误:
The superclass “javax.servlet.http.HttpServlet” was not found on the Java Build Path

3、在pom.xml中添加cargo插件

<build>
    <finalName>maven08finalName>
    <plugins>
        <plugin>
          <groupId>org.codehaus.cargogroupId>
          <artifactId>cargo-maven2-pluginartifactId>
          <configuration>
            <container>
              <containerId>tomcat8xcontainerId>
              <home>D:\Program Files\eclipse-jee-neon-R-win32-x86_64\apache-tomcat-8.0.36home>
            container>
            <configuration>
              <type>existingtype>
              <home>D:\Program Files\eclipse-jee-neon-R-win32-x86_64\apache-tomcat-8.0.36home>
            configuration>
          configuration>
          <executions>  
             <execution>  
                 <id>cargo-runid>  
                 <phase>installphase>  
                 <goals>  
                     <goal>rungoal>  
                 goals>  
             execution>  
         executions>
    plugin>
    plugins>
  build>

你可能感兴趣的:(maven cargo 插件自动部署web项目到tomcat)