Maven reactor and site
Asked Answered
D

1

2

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?

Darius answered 5/3, 2013 at 11:5 Comment(1)
Related: #12007505Washko
E
2

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.

Engrossing answered 6/3, 2013 at 0:59 Comment(3)
When focusing on reactor-build i have in mind the quote from the "Guide to Working with Multiple Modules" - "This part of the maven core does the following: 1) Collects all the available modules 2) Sorts the projects into the correct build order 3) Builds the selected projects in order". A bit suprising that this does not work for site's.Darius
The site also does the same way as well. You may see further information at site:stageEngrossing
Doing a maven install pollutes my local repository when all I want to do is generate a site for the current snapshot source tree. For most plugins, combining the plugin with the package lifecycle (e.g. mvn package dependency:tree) does the trick. Not so for site. I'm tempted to call it a bug.Washko

© 2022 - 2024 — McMap. All rights reserved.