Tomcat 9的Maven插件 [英] Maven plugin for Tomcat 9

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

问题描述

除了tomcat7-maven-plugin之外,我没有找到任何tomcat-maven-plugin. 我可以将其与apache-tomcat-9.0.0.M15一起使用吗?

I didn't find any tomcat-maven-plugin other than tomcat7-maven-plugin. Can I use it with apache-tomcat-9.0.0.M15?

推荐答案

是的,您可以使用它.我尝试了一下,并在tomcat 9上为我工作了

Yes you can use it. I tried and it worked for me on tomcat 9

<plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <version>2.2</version>
    <configuration>
        <url>http://localhost:8080/manager/text</url>
        <server>TomcatServer</server>
        <path>/myapp</path>
    </configuration>
</plugin>

主要目标:

mvn tomcat7:deploy
mvn tomcat7:undeploy
mvn tomcat7:redeploy

注意:不要忘记在tomcat-users.xml和maven settings.xml中添加tomcat用户

Note: Don't forget to add tomcat user in tomcat-users.xml and maven settings.xml

tomcat-user.xml

tomcat-user.xml

<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
  <role rolename="manager-gui"/>
  <role rolename="manager-script"/>
  <user username="admin" password="password" roles="manager-gui,manager-script" />
</tomcat-users>

管理脚本角色使应用程序(即maven)能够将jar/war部署到应用程序服务器.

manager-script role enables applications i.e., maven, to deploy jar/war to application server.

Maven文件settings.xml

Maven file settings.xml

<?xml version="1.0" encoding="UTF-8"?>
<settings ...>
    <servers>
        <server>
            <id>TomcatServer</id>
            <username>admin</username>
            <password>password</password>
        </server>
    </servers>
</settings>

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

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