简体   繁体   English

如何决定在 maven 中使用哪个插件?

[英]How to decide which plugin to use in maven?

I was going through the maven documentation.我正在浏览 maven 文档。 I saw maven works using plugins, for each phase there is one or more plugin and for each plugin there is one or more goals.我看到 maven 使用插件工作,每个阶段都有一个或多个插件,每个插件都有一个或多个目标。 there are plugin for compile, install, deploy, clean etc. I saw in my project they used maven-clean-plugin.有用于编译、安装、部署、清理等的插件。我在我的项目中看到他们使用了 maven-clean-plugin。 Then how maven clean install command is working if we did not put the maven-install-plugin?如果我们没有放置 maven-install-plugin,那么 maven 全新安装命令如何工作? Question might be bit silly but i am new the this world and appreciate your help.问题可能有点傻,但我是这个世界的新手,感谢您的帮助。

That would follow up with some default configuration of each plugin inherited with Maven's BOM.这将跟进 Maven 的 BOM 继承的每个插件的一些默认配置。 Executing执行

mvn dependency:resolve-plugins

shall help you identify these versions of the plugins inherited.将帮助您识别这些继承的插件版本。

So primarily to ensure you work with a specific(or updated) version of the plugin with the desired configuration of your project, you can explicitly define them in the pom.xml , otherwise, just let be.因此,主要是为了确保您使用具有所需项目配置的插件的特定(或更新)版本,您可以在pom.xml中明确定义它们,否则,就这样吧。

The Maven lifecycle has standard bindings for plugins to the different phases. Maven 生命周期具有插件到不同阶段的标准绑定。

If you run mvn clean install you run the plugins that a attached to the phases by default.如果您运行mvn clean install ,则默认运行附加到阶段的插件。

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

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