Tomcat 8与Maven集成 [英] Tomcat 8 integration with Maven

查看:145
本文介绍了Tomcat 8与Maven集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

听起来像Eclipse(开普勒)没有适合的Tomcat 8插件。我想将.war部署到Tomcat 8中,并由Maven pom.xml文件运行。任何人都可以提供一步一步的指导或任何资源?

It sounds like Eclipse (Kepler) does not have a proper plugin for Tomcat 8. I want to deploy my .war into Tomcat 8 and run it by Maven pom.xml file. Can anyone provide me step-by-step guidance or any resources, please?

我的POM文件:

<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>Test-App</groupId>
  <artifactId>test-rest</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>test-rest Maven Webapp</name>
  <url>http://maven.apache.org</url>
     <!-- Tomcat plugin -->


  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
  <plugins>
  <plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <version>2.2</version>
    <configuration>
     <path>/${project.build.finalName}</path>
     <update>true</update>
     <url>http:// localhost:8080/manager/text</url>
     <username>tomcat</username>
     <password>tomcatuser</password>
    </configuration>
   </plugin>
   </plugins>
    <finalName>test-rest</finalName>
  </build>
</project>


推荐答案

可以使用货物pluygin,我,部署到tomcat8:

Can you use the cargo pluygin instead, this works for me, deploying to tomcat8 :

             <plugin>
                <groupId>org.codehaus.cargo</groupId>
                <artifactId>cargo-maven2-plugin</artifactId>
                <version>1.4.8</version>
                <configuration>
                    <container>
                        <containerId>tomcat8x</containerId>
                        <home>${env.CATALINA_HOME}</home>
                    </container>
                    <configuration>
                        <type>existing</type>
                        <home>${env.CATALINA_HOME}</home>
                    </configuration>
                    <deployables>
                        <deployable>
                            <groupId>com.yourcompany</groupId>
                            <artifactId>ROOT</artifactId>
                            <type>war</type>
                            <properties>
                                <context>${project.build.finalName}</context>
                            </properties>
                        </deployable>
                    </deployables>
                    <deployer>
                        <type>installed</type>
                    </deployer>
                </configuration>
            </plugin>

这篇关于Tomcat 8与Maven集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆