maven如何只编译修改后的java文件? [英] How does maven compile only the modified java files?

查看:42
本文介绍了maven如何只编译修改后的java文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想知道这一点,当我在没有执行clean"的情况下进行 mvn install 时,maven 只编译修改后的 java 文件.maven如何识别一个java文件是否被修改?我相信它没有使用文件的最后修改属性.

I was just curious to know this, when i give mvn install without doing 'clean', maven compiles only the modified java files. How does maven identify a java file is modified or not? I believe it is not using the last modified property of the file.

我相信的原因:我有一个模块,在从 svn 合并更改后,我给了 mvn install 但它没有编译修改后的文件,当我查看更改时,我看到 'long' 被修改为 '长在 getter 和 setter 中.

Reason for my belief: I had a module, after merging a change from svn, i gave mvn install and it didn't compile the modified file and when i looked at the change i saw that 'long' were modified to 'Long' in getters and setters.

所以我只想知道 maven 如何识别 java 文件是否已更改?

So i just want to know how maven identifies if a java file has changed or not?

(P.S 我使用的是 Apache Maven 3.0.3,如果这很重要)

(P.S I'm using Apache Maven 3.0.3, if that matters)

推荐答案

我相信 Maven 编译器插件使用源文件和类文件上的最后修改日期来确定是否需要重新编译.

I believe the Maven compiler plugin uses last modified dates on the source and class files to determine whether recompilation is necessary.

编译器网站的信息相当少,但是compiler:compile 目标页面包含有关以下属性的信息,该属性可微调陈旧度计算:http://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html#staleMillis.这是关于过时的唯一官方声明.

The compiler website is rather short on information, but the compiler:compile goal page has information on the following attribute, which finely tunes the staleness calculations: http://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html#staleMillis. That's about the only official statement regarding staleness.

这篇关于maven如何只编译修改后的java文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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