使用

使用

同步滚动:

原文地址:http://maven.apache.org/plugins/maven-compiler-plugin/usage.html

使用

编译 Java 源码

The goals for the Compiler Plugin are bound to their respective phases in the build lifecycle. So to compile your sources, you need only to tell maven until which lifecycle to execute. The following will compile your sources:

编译器插件的目标绑定到构建生命周期中各自的阶段。所以要编译源代码,只需告诉maven要执行哪个生命周期。以下内容将编译您的源代码:

1. mvn compile

编译器插件的目标绑定到构建生命周期中各自的阶段。没看懂?如何解释?

To compile your test sources, you'll do:

<pre class="prettyprint linenums">

  1. mvn test-compile

</pre>

The above command will execute both <tt>compiler:compile</tt> and <tt>compiler:testCompile</tt> since the <tt>compile</tt> phase happens a few phases before the <tt>test-compile</tt> phase.

Configuring Your Compiler Plugin

Since the Compiler Plugin executes automatically during their phases, you don't have to put <tt>executions</tt> unlike many other plugins. However, you should specify the version of the Compiler Plugin.

<pre class="prettyprint linenums">

  1. <project>
  2. ...
  3. <build>
  4. <pluginManagement>
  5. <plugins>
  6. <plugin>
  7. <groupId>org.apache.maven.plugins</groupId>
  8. <artifactId>maven-compiler-plugin</artifactId>
  9. <version>3.8.1</version>
  10. <configuration>
  11. </configuration>
  12. </plugin>
  13. </plugins>
  14. </pluginManagement>
  15. </build>
  16. ...
  17. </project>

</pre>

Note: Maven 3.0 will issue warnings if you do not specify the version of a plugin.

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容