16

I am currently facing the following problem with Maven 3 when I am trying to build the site. I will appreciate you help on this.

mvn clean site

..........
[INFO] Reactor Summary:
[INFO] 
[INFO] Project A ......................................... SUCCESS [15.383s]
[INFO] Project B ......................................... SUCCESS [2.232s]
[INFO] My Site ........................................... FAILURE [0.105s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 24.769s
[INFO] Finished at: Fri Jun 29 14:26:04 AMT 2012
[INFO] Final Memory: 18M/150M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.1:site (default-site) on project site: SiteToolException: Unable to read local module-POM: 1 problem was encountered while building the effective model for my.com:projA:0.1-SNAPSHOT
[ERROR] [FATAL] Non-resolvable parent POM: Could not find artifact my.com:parent-pom:pom:0.1-SNAPSHOT and 'parent.relativePath' points at no local POM @ line 12, column 13
[ERROR] for project my.com:projA:0.1-SNAPSHOT
.............

First here is the configuration:

Apache Maven 3.0.4 (r1232337; 2012-01-17 12:44:56+0400)
Java version: 1.7.0_04, vendor: Oracle Corporation
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.7.4", arch: "x86_64", family: "mac"
Nexus repository: 2.0.6

The parent POM:

<modelVersion>4.0.0</modelVersion>

<name>Parent POM</name>
<groupId>my.com</groupId>
<artifactId>parent-pom</artifactId>
<version>0.1-SNAPSHOT</version>
<packaging>pom</packaging>

<build>                         
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-site-plugin</artifactId>
                <version>3.1</version>  
                <configuration>
                    <reportPlugins>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-project-info-reports-plugin</artifactId>
                            <version>2.4</version>
                        </plugin>            
                    </reportPlugins>
                </configuration>
            </plugin>              
        </plugins>
    </pluginManagement>      
</build>

The aggregation project pom:

<modelVersion>4.0.0</modelVersion>

<name>My Site</name>
<groupId>my.com</groupId>
<artifactId>site</artifactId>
<version>0.1-SNAPSHOT</version>
<packaging>pom</packaging>

<parent>
    <groupId>my.com</groupId>
    <artifactId>parent-pom</artifactId>
    <version>0.1-SNAPSHOT</version>
    <relativePath/>
</parent>

<modules>

    <module>projA</module>
    <module>projB</module>

</modules> 

The pom of Project A:

<modelVersion>4.0.0</modelVersion>

<name>Project A</name>
<groupId>my.com</groupId>
<artifactId>projA</artifactId>
<version>0.1-SNAPSHOT</version>

<parent>
    <groupId>my.com</groupId>
    <artifactId>parent-pom</artifactId>
    <version>0.1-SNAPSHOT</version>
    <relativePath/>        
</parent>

The pom of Project B:

4.0.0

<name>Project B</name>
<groupId>my.com</groupId>
<artifactId>projB</artifactId>
<version>0.1-SNAPSHOT</version>

<parent>
    <groupId>my.com</groupId>
    <artifactId>parent-pom</artifactId>
    <version>0.1-SNAPSHOT</version>
    <relativePath/>        
</parent> 

Here is the structure of the folder where I run "mvn clean site":

./pom.xml  (aggregation project)
./projA/pom.xml (Project A)
./projB/pom.xml (Project B)

parent-pom is successfully deployed to NEXUS repository before the execution of mvn clean site with following command mvn deploy -DaltDeploymentRepository=snapshots::default::http://MyServer:8081/nexus/content/repositories/snapshots

And finally the problem itself:

When I run mvn clean site right after the deployment of parent-pom site is built successfully. If I delete the folder (with its content) "my" (it contains the parent-pom) from the local repository (~/.m2/repository) and then try to build the site with mvn clean site I am getting the error described at the beginning. Actually Maven downloads the parent-pom from the NEXUS. I have compared the downloaded files and files which have been generated after the deployment and have realized that few are missing, for instance maven-metadata-local.xml near to "0.1-SNAPSHOT" folder.

So when I am trying to run the site building job from Jenkins I am getting the error described above, because the parent-pom is not deployed from the machine where Jenkins run.

How can I come up with this problem or what I did wrong?

Thank you.

tgrigoryan
  • 249
  • 1
  • 2
  • 6
  • I would remove the relativePath entry of your modules, cause it's empty so its not needed. Can you enhance the picture with the folder structure where your parent pom is located? And why are the parent pom and the aggregation pom are different ones ? – khmarbaise Jun 29 '12 at 12:31
  • 2
    forces maven to download parent POM from the repository, instead of looking it up in the structure. If I remove it maven shows warnings because it starts to think that the parent is in ../pom.xml, which is not true. Regarding the aggregation and inheritance. It is OK to have different parent and aggregation POMs. Here is the link: [Aggregation vs Inheritance](http://maven.apache.org/pom.html#Inheritance_v) – tgrigoryan Jun 29 '12 at 14:32
  • I know that's possible having different aggregator and parentbut it makes life not easier. – khmarbaise Jun 29 '12 at 14:38
  • For our project I have created one root pom which defines all common properties, distribution management and etc. Then it is inherited with another one, which is used for pure java (jar) projects. I really can't compromise the structure. If it has to work, why it has not? Moreover, I have looked into Maven's POMs. They have similar structure as well, although they provide the relative path to parents (not aggregations) instead of loading them from repository. – tgrigoryan Jun 29 '12 at 14:52
  • 1
    The most embarrassing is that everything works fine if parent pom is just deployed from the same machine or is installed on the same machine. When parent is downloaded from repository maven site plugin does not find it. But rest works fine again, i.e. compile, deploy and etc. – tgrigoryan Jun 29 '12 at 14:55
  • at the risk of sounding like a stuck record - I have the same problem... is it not a bug in maven? – Michael Wiles Apr 04 '13 at 15:37

3 Answers3

4

As pointed out by this answer, there is a bug in the site plugin, which only looks for dependencies in what it thinks is Maven central.

I am having the same problem in Maven 3.0.4 and site-plugin 3.3 . I also have the issue that it works in my development machine which is running Windows 7, but not in the CI-Server which is running Jenkins on Debian.

Community
  • 1
  • 1
AdrianRM
  • 2,622
  • 2
  • 25
  • 42
3

The problem is not in your pom files. When I built your aggregation-pom, Maven downloaded normally the parent-pom from the remote repo (after I deleted from my local repo).

Try this:

mvn -U clean install site dependency:purge-local-repository

Additionally, you could do some clean up:

  • remove <relativePath/> from all of them
  • remove <version>0.1-SNAPSHOT</version> and <groupId>my.com</groupId> from projA and ProjB (they are inherited from the parent)
cahen
  • 15,807
  • 13
  • 47
  • 78
1

I got the same problem... works on my developer MacBook, but fails on my Jenkins running on RHEL7 when running mvn site using maven-site-plugin:3.7. I did not test to downgrade the site plugin.

I found another solution. The problem in my case was the maven-project-info-reports-plugin especially the goal dependencies. If I skip the goal with -Dmpir.skip=true my site get's generated (without the dependencies :( report).

Dominik
  • 11
  • 1