Maven site 命令运行过慢的一个原因,以及解决方法

今天开始用 Maven Site 功能为项目补充文档,却发现 mvn site 运行起来非常慢,基本上就是没头的感觉。起初以为是因为项目大的缘故,后来日志中反复出现的一句话引起了我的注意。


[ERROR] Unable to determine if resource groupId:artifactId:version:compile exists in http://your_repository_url

这句话是 Maven 的 dependency report plugin 输出的。这个插件在 Maven site 的执行过程中会去检查每一个 dependency 存在于哪一个 repository 中。如果这个检查失败,那便会导致 Maven site 没天理地缓慢(尤其是大型项目来说,因为 dependency 实在太多了)。

解决方式是在运行 Maven site 功能时加上一个参数:-Ddependency.locations.enabled=false 。这样就可以解决这个问题。

最后感谢这位外国同行的博客:http://whatiscomingtomyhead.wordpress.com/2011/04/20/if-your-maven-site-build-is-too-slow/

你可能感兴趣的:(maven)