mavenmaven-site-pluginmaven-reactor

Maven reactor and site


I have a multi-module project with a parent pom.xml and several modules where some of the modules depend on each other. In the project directory I can call

mvn test

to run unittests in each module. No problem here. But if I call

mvn site

one of the modules reports

[ERROR] Failed to execute goal on project myModule_C: Could not resolve dependencies 
for project org.myModule_C:jar:0.0.1-SNAPSHOT: The following artifacts could not be
resolved: org.myModule_A:jar:0.0.1-SNAPSHOT, org.myModule_B:jar:0.0.1-SNAPSHOT: Failure
to find org.myModule_A:jar:0.0.1-SNAPSHOT in http://artifactory-server:8081/artifactory/repo
was cached in the local repository, resolution will not be reattempted until the update
interval of server has elapsed or updates are forced -> [Help 1]

I think this should not happen since these dependencies are found during "mvn test". Also, they are not in the artifactory-server but part of the parent project. The goal that is mentioned in the ERROR is the goal site. Why does the mvn test succeed (with respect to dependencies it finds) and mvn site does not? Do I have to build the site in a special way - because this is a reactor build?


Solution

  • You should execute the mvn install as least once. Please see further information at the Maven Build Life Cycle and Maven in 5 Minutes.

    Here is the overview

    Maven Phases

    Although hardly a comprehensive list, these are the most common default lifecycle phases executed.

    validate: validate the project is correct and all necessary information is available

    compile: compile the source code of the project

    test: test the compiled source code using a suitable unit testing framework. These tests should not require the code be packaged or deployed

    package: take the compiled code and package it in its distributable format, such as a JAR.

    integration-test: process and deploy the package if necessary into an environment where integration tests can be run

    verify: run any checks to verify the package is valid and meets quality criteria

    install: install the package into the local repository, for use as a dependency in other projects locally

    deploy: done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects.

    There are two other Maven lifecycles of note beyond the default list above

    They are:

    clean: cleans up artifacts created by prior builds

    site: generates site documentation for this project

    I hope this may help.