Monday, December 3, 2012

Maven - slow generating "Dependencies" report.

sometimes we have encountered very slow generating of maven site at first glance process was slow down by generating dependency report.
[INFO] Skipped "About" report, file "index.html" already exists for the English version.
[INFO] Generating "Issue Tracking" report.
[INFO] Generating "Project Team" report.
[INFO] Generating "Dependency Management" report.
[INFO] Generating "Dependencies" report.
[ERROR] Unable to determine if resource cglib:cglib:jar:2.0.2:compile exists in http://repo1.maven.org/maven2
[ERROR] Unable to determine if resource commons-collections:commons-collections:jar:2.1.1:compile exists in http://repo1.maven.org/maven2
[ERROR] Unable to determine if resource commons-logging:commons-logging:jar:1.0.4:compile exists in http://repo1.maven.org/maven2
[ERROR] Unable to determine if resource cz.xxxxx.xxx.xxx:xxx:jar:1.0.0:compile exists in http://repo1.maven.org/maven2
Problem is in maven dependency plugin. Which try to locate in which repository is artefact located. When there is no valid internet connection (e.g. you use firewall) problem could appears.
If it's your problem there is few ways how to fix it:

1. add runtime property

dependency.locations.enabled=false in commando line like this:
mvn -Ddependency.locations.enabled=false site

2. change pom.xml

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

3. Run site goal in offline mode

Even build site in offline mode like this:
mvn -o site
In that case you'll see following message in logs:
[WARNING] The parameter 'dependencyLocationsEnabled' is ignored in offline mode.

No comments:

Post a Comment