Maven 编译器插件 [英] Maven Compiler Plugin

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

问题描述

我知道 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 to explicitly define it in our POM, but I still seen experienced developer putting things like this 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 编译器插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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