问题描述
我知道 DEFAULT 的 Maven 编译器插件绑定到:
I know Maven compiler plugin by DEFAULT is bind to :
- 编译
- 测试编译
生命周期,一般不指定附加配置,我们不必在我们的 POM 中明确定义它,但我仍然看到有经验的开发人员将诸如这在他们的 POM 中,例如
life cycles, in general without specifying addition configuration, we don't have toexplicitly define it in our POM, but I still seen experienced developer putting things likethis in their POM, e.g
<build>
<plugins>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
</plugins>
</build>
我徘徊有什么意义?他为什么要这样做?
I wander what's the point? and why is he doing this?
推荐答案
对于 shade 插件,他大概是使用了 POM 继承.在父 POM 层次结构中查看 pluginManagement
部分,那里可能有他正在拉入此模块的阴影插件配置.
For the shade plugin, he is probably using POM inheritance. Look in the parent POM hierarchy for a pluginManagement
section, there is probably shade plugin configuration there that he is pulling into this module.
对于编译器插件,我不知道.你是对的,对于 jar/war/ear/ejb 项目,Maven 会自动引入编译器配置,即使他在父 POM 的 pluginManagement
部分定义了特定的配置.
For the compiler plugin, I do not know. You are correct, for jar/war/ear/ejb projects Maven will pull in the compiler config automatically, even if he has defined specific configuration in a parent POM's pluginManagement
section.
这篇关于Maven 编译器插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!