简单地说,我得到了这个结果
$ time mvn generate-sources ; date
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building connect-ui 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-antrun-plugin:1.8:run (default) @ connect-ui ---
[INFO] Executing tasks
<Ant task that does a copy followed by a search and replace.>
[INFO] Executed tasks
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.637 s
[INFO] Finished at: 2015-05-19T18:14:14+02:00
[INFO] Final Memory: 9M/311M
[INFO] ------------------------------------------------------------------------
real 0m13.057s
user 0m15.760s
sys 0m0.246s
Tue May 19 18:14:26 CEST 2015
real 0m13.036s
user 0m15.807s
sys 0m0.292s
通过Maven的输出,似乎任务完成了。实际上,它生成的源可以在BUILD SUCCESS打印完成后立即使用。
但显然它浪费了更多时间。它可以是什么,我如何让Maven不再浪费那12秒?
FWIW,
$ java -version
java version "1.8.0_11"
Java(TM) SE Runtime Environment (build 1.8.0_11-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.11-b03, mixed mode)
使用-X(或--debug)运行没有任何区别 - Maven仍然说BUILD SUCCESS
然后有一个等待期(没有进一步的输出)。
为了好玩,我还尝试了mvn clean test:
time mvn -X clean ; date
Apache Maven 3.2.3 (33f8c3e1027c3ddde99d3cdebad2656a31e8fdf4; 2014-08-11T22:58:10+02:00)
Maven home: /usr/local/Cellar/maven/3.2.3/libexec
Java version: 1.8.0_11, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.10.3", arch: "x86_64", family: "mac"
[INFO] Error stacktraces are turned on.
...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.299 s
[INFO] Finished at: 2015-05-19T18:22:44+02:00
[INFO] Final Memory: 7M/291M
[INFO] ------------------------------------------------------------------------
real 0m12.805s
user 0m14.739s
sys 0m0.196s
Tue May 19 18:22:56 CEST 2015