Reactor and Maven Site

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

 mvn test 

to run unittests in each module. There is no problem. 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, as these dependencies were found during the mvn test. In addition, they are not located in the artifactory server, but are part of the parent project. The target indicated in the ERROR is the target of the site . Why is the success of mvn test (regarding the dependencies found) and mvn site not? Should I build the site in a special way, because this is a reactor assembly?

+2
source share
1 answer

You must run mvn install at least once. For more information, see The Maven Build and Maven Life Cycle in 5 Minutes .

Here is a review

Maven Phases

Although hardly a complete list, these are the most common default life cycle phases.

check : check the correctness of the project and get all the necessary information

compile : compile project source code

test : check the compiled source code using a suitable unit testing system. These tests do not require code to be packaged or deployed.

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

integration test : process and deploy the package, if necessary, into an environment in which integration tests can be performed

check : perform all checks to ensure that the package is valid and meets the quality criteria

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

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

There are two other Maven life cycles outside the default list above . They are

clean : cleans artifacts created by previous builds

site : creates site documentation for this project

Hope this helps.

+2
source

Source: https://habr.com/ru/post/923125/


All Articles