简体   繁体   English

tomcat-maven-plugin的用途是什么?

[英]What is the purpose of tomcat-maven-plugin?

I'm having some difficulty understanding the purpose of this plugin. 我在理解此插件的用途时遇到了一些困难。 Is it to modify the settings in Tomcat during the build? 是否在构建过程中修改Tomcat中的设置?

I am deploying to tomcat using maven, without the plugin and it seems to work fine. 我正在使用Maven部署到tomcat,而没有插件,它似乎工作正常。 Not sure if I am missing something 不知道我是否想念一些东西

Cheers 干杯

Maven Tomcat plugin basically just bootstraps an embedded Tomcat container for you. Maven Tomcat插件基本上只是为您引导嵌入式Tomcat容器。 Saves you the trouble of configuring an external Tomcat instance for development purposes. 无需为开发目的而配置外部Tomcat实例的麻烦。 It can also auto-start this Tomcat instance during the build and run integration tests on it, stopping it afterwards. 它还可以在构建过程中自动启动此Tomcat实例并对其进行集成测试,然后再将其停止。 If you already have a functioning workflow that you're comfortable with, no need to introduce the plugin, but it's pretty easy to configure, can run multiple web apps, can run unassembled applications etc so it's convenient to have for local development. 如果您已经拥有了一个可以正常使用的工作流程,则无需介绍该插件,但是它非常易于配置,可以运行多个Web应用程序,可以运行未组装的应用程序等,因此便于本地开发。 An even more light-weight alternative would be the Jetty plugin which starts an embedded Jetty server instead. 一个更轻巧的选择是Jetty插件,它可以启动嵌入式Jetty服务器。

Maven is actually a plugin execution framework where every task is actually done by plugins. Maven实际上是一个插件执行框架,其中每个任务实际上都是由插件完成的。

Maven Plugins are generally used to : Maven插件通常用于:

create jar file

create war file

compile code files

unit testing of code

create project documentation

create project reports

A plugin generally provides a set of goals and which can be executed using following syntax: 插件通常提供一组目标,可以使用以下语法执行该目标:

mvn [plugin-name]:[goal-name] mvn [插件名称]:[目标名称]

For example, a Java project can be compiled with the maven-compiler-plugin's compile-goal by running following command 例如,可以通过运行以下命令,使用maven-compiler-plugin的compile-goal来编译Java项目。

mvn compiler:compile mvn编译器:compile

for more information go to http://www.tutorialspoint.com/maven/maven_plugins.htm 有关更多信息,请访问http://www.tutorialspoint.com/maven/maven_plugins.htm

so pulgins is used to execute goals. 因此,p子是用来执行目标的。 suppose if you don't include plugin that is required in your execution environment then it will throw an error like 假设如果您不包括执行环境中所需的插件,那么它将抛出类似

A required class is missing: Lorg/apache/maven/plugin/BuildPluginManager; 缺少必需的类:Lorg / apache / maven / plugin / BuildPluginManager;

so by adding appropriate plugin in pom.xml it will resolve the dependencies and execute the goal succesfully. 因此,通过在pom.xml中添加适当的插件,它将解决依赖关系并成功执行目标。

to remove above error just add the following plugins : 要消除上述错误,只需添加以下插件:

       <plugin>
    <groupId>com.atlassian.maven.plugins</groupId>
    <artifactId>maven-amps-plugin</artifactId>
    <version>${amps.version}</version>
    <extensions>true</extensions>
</plugin>

Maven is a framework used to build JAVA applications, it provides the following Maven是用于构建JAVA应用程序的框架,它提供了以下内容

  • Directory Structure 目录结构

  • Configuration Files 配置文件

  • Build Settings 构建设置

It helps in easy and structured development, primarily used for REST API Calls. 它有助于简单,结构化的开发,主要用于REST API调用。 Applications built on Maven Framework, would require the same to be deployed 基于Maven框架构建的应用程序将需要部署相同的应用程序

Its better that you get the plugin installed, since on a long run you never know what dependency may go missing 最好安装插件,因为从长远来看,您永远都不知道会丢失什么依赖项

-If this helps, Mark as Answer -如果有帮助,请标记为答案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM