在Eclipse中,如何运行修改上下文路径的Tomcat Maven插件 [英] Within Eclipse, how to run Tomcat Maven plugin that modifies the context path
问题描述
在Eclipse内安装了m2 Maven插件.我可以使用在服务器上运行"命令通过Eclipse WTP在Tomcat中运行webapp.
Inside Eclipse with m2 Maven plugin installed. I can run my webapp in Tomcat via Eclipse WTP using "Run on Server" command.
现在,我想通过Maven修改上下文路径,因此我使用以下插件:
Now I want to modify the context-path via Maven, so I use the following plugin:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>1.1</version>
<configuration>
<path>${contextpath-name}</path>
</configuration>
</plugin>
但是,然后您如何在Eclipse中准确地运行此插件.使用Eclipse WTP总是给我以下URL-http://localhost:8080/myapp
But then how do you exactly run this plugin inside Eclipse. Using Eclipse WTP always gives me the following URL - http://localhost:8080/myapp
我知道我可以在独立的Maven上运行插件,但是我想知道如何在Eclipse中实现
I know I could run the plugin on a standalone Maven, but I want to know how to do it within Eclipse
推荐答案
假设
我假设您已经为Eclipse安装了Maven插件.
I am assuming that you have already installed the plugins for Maven for eclipse.
安装
在项目浏览器中选择项目时,选择运行->运行方式-> Maven安装
While selecting the project in project explorer select Run --> Run As --> Maven Install
运行Tomcat
转到运行->运行配置.
Go to Run --> Run Configurations..
添加新的Maven构建
Add new Maven Build
命名进程,选择将被部署为war的基本目录
Name the Process, Select the Base directory that will be deployed as war
设置目标-> tomcat:run (这是Tomcat的默认目标)
按照以下步骤,您可以通过Eclipse部署所有内容.
By following the steps you can deploy every thing via Eclipse.
玩得开心. :)
这篇关于在Eclipse中,如何运行修改上下文路径的Tomcat Maven插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!