Maven site build is very slow dependency report

摘要: Creating a Maven site, but the build is very slow to generate the dependency report.

Creating a Maven site, but the build is very slow to generate the dependency report.

C:\mkyong_projects\>mvn site
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------------------------
[INFO] Building Maven Webapp 1.0-SNAPSHOT
[INFO] --------------------------------------
[INFO]
//...
[INFO] Generating "Project License" report
[INFO] Generating "Project Team" report 
[INFO] Generating "Project Summary" report
[INFO] Generating "Dependencies" report
//...... Hanging here...

1. Trace

Maven debug it with option -X, when generate the dependency report, it keeps open connections to other websites.

C:\mkyong_projects\>mvn -X site
//...
http://google-gson.googlecode.com/svn/mavenrepo - Session: Opened
http://google-gson.googlecode.com/svn/mavenrepo - Session: Disconnecting
http://google-gson.googlecode.com/svn/mavenrepo - Session: Disconnected
http://files.couchbase.com/maven2/ - Session: Opened
http://files.couchbase.com/maven2/ - Session: Disconnecting
http://files.couchbase.com/maven2/ - Session: Disconnected
http://repo.maven.apache.org/maven2 - Session: Opened
http://repo.maven.apache.org/maven2 - Session: Disconnecting
http://repo.maven.apache.org/maven2 - Session: Disconnected
http://repository.jboss.org/nexus/content/groups/public/ - Session: Opened
http://repository.jboss.org/nexus/content/groups/public/ - Session: Disconnecting
http://repository.jboss.org/nexus/content/groups/public/ - Session: Disconnected
//... Long list, seem like never end

2. Solution

Above project is using too many third party libraries (which Java project doesn’t?), resolve too many dependencies caused the slow building. To solve it, skip the dependency report generation.

Solution 1
Build it offline with option -o, dependency report will be ignored.

C:\mkyong_projects\>mvn -o site
//...
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------------------------
[INFO] Building Maven Webapp 1.0-SNAPSHOT
[INFO] --------------------------------------
[INFO]
//...
[INFO] Generating "Project License" report
[INFO] Generating "Project Team" report 
[INFO] Generating "Project Summary" report
[INFO] Generating "Dependencies" report
[WARNING] The parameter 'dependencyLocationsEnabled' is ignored in offline mode.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.428s
[INFO] Finished at: Thu Jan 09 22:21:53 SGT 2014
[INFO] Final Memory: 52M/706M

Solution 2
Declares the “maven-project-info-reports-plugin” in reporting section, and set dependencyLocationsEnabled to false. When creating the Maven site, dependency report generation will be skipped.

pom.xml
  <reporting>
    <plugins>
	<plugin>
		<groupId>org.apache.maven.plugins</groupId>
		<artifactId>maven-project-info-reports-plugin</artifactId>
		<version>2.7</version>
		<configuration>
		  <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
		</configuration>
	</plugin>
    </plugins>
  </reporting>

References

  1. Maven – Creating a site
  2. In Maven 2, how do I know from which dependency comes a transitive dependency?

上一篇: Maven + Emma code coverage example
下一篇: Emma Class x appears to be instrumented already
 评论 ( What Do You Think )
名称
邮箱
网址
评论
验证
   
 

 


  • 微信公众号

  • 我的微信

站点声明:

1、一号门博客CMS,由Python, MySQL, Nginx, Wsgi 强力驱动

2、部分文章或者资源来源于互联网, 有时候很难判断是否侵权, 若有侵权, 请联系邮箱:summer@yihaomen.com, 同时欢迎大家注册用户,主动发布无版权争议的 文章/资源.

3、鄂ICP备14001754号-3, 鄂公网安备 42280202422812号