Failed to resolve artifact when I run "mvn deploy site-deploy" but works fine if I split the command "mvn deploy" and then "mvn site-deploy"

StackOverflow https://stackoverflow.com/questions/23120594

  •  04-07-2023
  •  | 
  •  

Question

Build fails when I run mvn deploy site-deploy. But works fine when I split the command. i.e., First, mvn deploy and then mvn site-deploy.

All these years we were using the command mvn deploy site-deploy to perform our builds. We recently migrated to Sonatype Nexus repository and our very first build would fail.

We are using

  1. Maven 2.2.1 and Sonatype Nexus 2.7.2.
  2. maven.site.plugin 2.1.1 and wagon-webdav-jackrabbit 2.5 in our pom file.

Any advice or input is highly appreciated. Thank you!!! :)


Our project consist of 5 child modules. It says unable to resolve artifact version 1.00.03. But, the artifact that it says missing, is the one that's currently building.

Build Logs:

/some/codebase/directory/>mvn deploy site-deploy
[INFO] Scanning for projects...
[INFO] Reactor build order: 
[INFO]   My Example Project
[INFO]   Module1
[INFO]   Module2
[INFO]   Module3
[INFO]   Module4
[INFO]   Module5
[INFO] ------------------------------------------------------------------------
[INFO] Building My Example Project
[INFO]    task-segment: [deploy, site-deploy]
[INFO] ------------------------------------------------------------------------
[INFO] [site:attach-descriptor {execution: default-attach-descriptor}]
[INFO] [install:install {execution: default-install}]
[INFO] Installing /some/codebase/directory/pom.xml to /home/.m2/repository/com/example/app/example-app/1.00.03/example-app-1.00.03.pom
[INFO] Installing /some/codebase/directory/target/example-app-1.00.03-site.xml to /home/.m2/repository/com/example/app/example-app/1.00.03/example-app-1.00.03-site.xml
[INFO] [deploy:deploy {execution: default-deploy}]
Uploading: http://localhost:8081/nexus/content/repositories/release/com/example/app/examplel-app/1.00.03/example-app-1.00.03.pom
4/14K
8/14K
12/14K
14/14K
14K uploaded  (example-app-1.00.03.pom)
[INFO] Retrieving previous metadata from nexus
[INFO] Uploading repository metadata for: 'artifact com.example.app:example-app'
Uploading: http://localhost:8081/nexus/content/repositories/release/com/example/app/examplel-app/1.00.03/example-app-1.00.03-site.xml
1/1K
1K uploaded  (example-app-1.00.03-site.xml)
[INFO] [site:site {execution: default-site}]
[INFO] Generating "Source Repository" report.
[WARNING] Deprecated API called - not org.apache.maven.doxia.sink.Sink instance and no SinkFactory available. Please update this plugin.
[INFO] Generating "Dependencies" report.
[WARNING] Deprecated API called - not org.apache.maven.doxia.sink.Sink instance and no SinkFactory available. Please update this plugin.
[INFO] [site:deploy {execution: default-deploy}]
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
http://localhost:8081/nexus/content/sites/site/com.example.app/example-app - Session: Opened  
Uploading: ./index.html to http://localhost:8081/nexus/content/sites/site/com.example.app/example-app

##http://localhost:8081/nexus/content/sites/site/com.example.app/example-app/./index.html - Status code: 201

Transfer finished. 4983 bytes copied in 0.028 seconds
Uploading: ./source-repository.html to http://localhost:8081/nexus/content/sites/site/com.example.app/example-app

##http://localhost:8081/nexus/content/sites/site/com.example.app/example-app/./source-repository.html - Status code: 201

Transfer finished. 5104 bytes copied in 0.024 seconds
Uploading: ./dependencies.html to http://localhost:8081/nexus/content/sites/site/com.example.app/example-app

#####http://localhost:8081/nexus/content/sites/site/com.example.app/example-app/./dependencies.html - Status code: 201

Transfer finished. 20165 bytes copied in 0.024 seconds
Uploading: ./images/close.gif to http://localhost:8081/nexus/content/sites/site/com.example.app/example-app

#http://localhost:8081/nexus/content/sites/site/com.example.app/example-app/./images/close.gif - Status code: 201

Transfer finished. 279 bytes copied in 0.022 seconds
Uploading: ./images/external.png to http://localhost:8081/nexus/content/sites/site/com.example.app/example-app

#http://localhost:8081/nexus/content/sites/site/com.example.app/example-app/./images/external.png - Status code: 201

Transfer finished. 230 bytes copied in 0.024 seconds
Uploading: ./images/icon_error_sml.gif to http://localhost:8081/nexus/content/sites/site/com.example.app/example-app

#http://localhost:8081/nexus/content/sites/site/com.example.app/example-app/./images/icon_error_sml.gif - Status code: 201

Transfer finished. 1010 bytes copied in 0.022 seconds
Uploading: ./images/icon_info_sml.gif to http://localhost:8081/nexus/content/sites/site/com.example.app/example-app

#http://localhost:8081/nexus/content/sites/site/com.example.app/example-app/./images/icon_info_sml.gif - Status code: 201

Transfer finished. 606 bytes copied in 0.023 seconds
Uploading: ./images/icon_success_sml.gif to http://localhost:8081/nexus/content/sites/site/com.example.app/example-app

#http://localhost:8081/nexus/content/sites/site/com.example.app/example-app/./images/icon_success_sml.gif - Status code: 201

Transfer finished. 990 bytes copied in 0.023 seconds
Uploading: ./images/icon_warning_sml.gif to http://localhost:8081/nexus/content/sites/site/com.example.app/example-app

#http://localhost:8081/nexus/content/sites/site/com.example.app/example-app/./images/icon_warning_sml.gif - Status code: 201

Transfer finished. 576 bytes copied in 0.023 seconds
Uploading: ./images/newwindow.png to http://localhost:8081/nexus/content/sites/site/com.example.app/example-app

#http://localhost:8081/nexus/content/sites/site/com.example.app/example-app/./images/newwindow.png - Status code: 201

Transfer finished. 220 bytes copied in 0.023 seconds
Uploading: ./images/expanded.gif to http://localhost:8081/nexus/content/sites/site/com.example.app/example-app

#http://localhost:8081/nexus/content/sites/site/com.example.app/example-app/./images/expanded.gif - Status code: 201

Transfer finished. 52 bytes copied in 0.021 seconds
Uploading: ./images/collapsed.gif to http://localhost:8081/nexus/content/sites/site/com.example.app/example-app

#http://localhost:8081/nexus/content/sites/site/com.example.app/example-app/./images/collapsed.gif - Status code: 201

Transfer finished. 53 bytes copied in 0.022 seconds
Uploading: ./images/logos/maven-feather.png to http://localhost:8081/nexus/content/sites/site/com.example.app/example-app

#http://localhost:8081/nexus/content/sites/site/com.example.app/example-app/./images/logos/maven-feather.png - Status code: 201

Transfer finished. 3330 bytes copied in 0.023 seconds
Uploading: ./images/logos/build-by-maven-white.png to http://localhost:8081/nexus/content/sites/site/com.example.app/example-app

#http://localhost:8081/nexus/content/sites/site/com.example.app/example-app/./images/logos/build-by-maven-white.png - Status code: 201

Transfer finished. 2260 bytes copied in 0.023 seconds
Uploading: ./images/logos/build-by-maven-black.png to http://localhost:8081/nexus/content/sites/site/com.example.app/example-app

#http://localhost:8081/nexus/content/sites/site/com.example.app/example-app/./images/logos/build-by-maven-black.png - Status code: 201

Transfer finished. 2294 bytes copied in 0.023 seconds
Uploading: ./project-info.html to http://localhost:8081/nexus/content/sites/site/com.example.app/example-app

##http://localhost:8081/nexus/content/sites/site/com.example.app/example-app/./project-info.html - Status code: 201

Transfer finished. 5764 bytes copied in 0.022 seconds
Uploading: ./css/maven-theme.css to http://localhost:8081/nexus/content/sites/site/com.example.app/example-app

#http://localhost:8081/nexus/content/sites/site/com.example.app/example-app/./css/maven-theme.css - Status code: 201

Transfer finished. 3517 bytes copied in 0.025 seconds
Uploading: ./css/maven-base.css to http://localhost:8081/nexus/content/sites/site/com.example.app/example-app

#http://localhost:8081/nexus/content/sites/site/com.example.app/example-app/./css/maven-base.css - Status code: 201

Transfer finished. 2462 bytes copied in 0.023 seconds
Uploading: ./css/print.css to http://localhost:8081/nexus/content/sites/site/com.example.app/example-app

#http://localhost:8081/nexus/content/sites/site/com.example.app/example-app/./css/print.css - Status code: 201

Transfer finished. 222 bytes copied in 0.047 seconds
Uploading: ./css/site.css to http://localhost:8081/nexus/content/sites/site/com.example.app/example-app

#http://localhost:8081/nexus/content/sites/site/com.example.app/example-app/./css/site.css - Status code: 201

Transfer finished. 53 bytes copied in 0.022 seconds
http://localhost:8081/nexus/content/sites/site/com.example.app/example-app - Session: Disconnecting  
http://localhost:8081/nexus/content/sites/site/com.example.app/example-app - Session: Disconnected
[INFO] ------------------------------------------------------------------------
[INFO] Building Module1
[INFO]    task-segment: [deploy, site-deploy]
[INFO] ------------------------------------------------------------------------
[INFO] [jaxb2:generate {execution: default}]
[INFO] Sources are not up-to-date; XJC execution will be executed.
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (ISO8859-1 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /some/codebase/directory/src/main/resource
[INFO] Copying 1 resource
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Compiling 14 source files to /some/codebase/directory/app-module1/target/classes
[INFO] [resources:testResources {execution: default-testResources}]
[WARNING] Using platform encoding (ISO8859-1 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /some/codebase/directory/app-module1/src/test/resources
[INFO] [compiler:testCompile {execution: default-testCompile}]
[INFO] No sources to compile
[INFO] [surefire:test {execution: default-test}]
[INFO] No tests to run.
[INFO] [jar:jar {execution: default-jar}]
[INFO] Building jar: /some/codebase/directory/app-module1/example-app-module1-1.00.03.jar
[INFO] [install:install {execution: default-install}]
[INFO] Installing some/codebase/directory/app-module1/target/example-app-module1-1.00.03.jar to home/.m2/repository/com/example/app/example-app/1.00.03/example-app-module1-1.00.03.jar
[INFO] [deploy:deploy {execution: default-deploy}]
Uploading: http://localhost:8081/nexus/content/repositories/release/com/example/app/examplel-app/1.00.03/example-app-module1-1.00.03.jar
4/22K
8/22K
12/22K
16/22K
20/22K
22/22K
22K uploaded  (example-app-module1-1.00.03.jar)
[INFO] Retrieving previous metadata from nexus
[INFO] Uploading repository metadata for: 'artifact com.example.app:example-app-module1'
[INFO] Uploading project information for example-app-module1 1.00.03
[WARNING] DEPRECATED [tags]: No reason given
[INFO] Preparing javadoc:aggregate
[INFO] ------------------------------------------------------------------------
[INFO] Building My example project
[INFO] ------------------------------------------------------------------------
[INFO] No goals needed for project - skipping
[INFO] ------------------------------------------------------------------------
[INFO] Building Module1
[INFO] ------------------------------------------------------------------------
[INFO] [jaxb2:generate {execution: default}]
[INFO] Generated sources are up-to-date; XJC execution will be skipped.
[INFO] ------------------------------------------------------------------------
[INFO] Building Module2
[INFO] ------------------------------------------------------------------------
[INFO] No goals needed for project - skipping
[INFO] ------------------------------------------------------------------------
[INFO] Building Module3
[INFO] ------------------------------------------------------------------------
[INFO] No goals needed for project - skipping
[INFO] ------------------------------------------------------------------------
[INFO] Building Module4
[INFO] ------------------------------------------------------------------------
[INFO] No goals needed for project - skipping
[INFO] ------------------------------------------------------------------------
[INFO] Building My Example Project
[INFO] ------------------------------------------------------------------------
[INFO] No goals needed for project - skipping
[INFO] ------------------------------------------------------------------------
[INFO] Building Module5
[INFO] ------------------------------------------------------------------------
[INFO] No goals needed for project - skipping
[INFO] ------------------------------------------------------------------------
[INFO] Building My Example project
[INFO] ------------------------------------------------------------------------
[INFO] No goals needed for project - skipping
[INFO] ------------------------------------------------------------------------
[INFO] Building Module1
[INFO] ------------------------------------------------------------------------
[INFO] [jaxb2:generate {execution: default}]
[INFO] Generated sources are up-to-date; XJC execution will be skipped.
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (ISO8859-1 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /some/codebase/directory/src/main/resource
[INFO] Copying 1 resource
[INFO] Copying 1 resource
[INFO] Copying 1 resource
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Nothing to compile - all classes are up to date
[INFO] ------------------------------------------------------------------------
[INFO] Building Module2
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (ISO8859-1 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Compiling 229 source files to /some/codebase/directory/app_module2/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] Building Module3
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (ISO8859-1 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 3 resources
[INFO] Copying 12 resources
Downloading: http://localhost:8081/nexus/content/groups/public/com/example/app/example-app-module2/1.00.03/example-app-module2-1.00.03.jar
[INFO] Unable to find resource 'com.example.app:example-app-module2:jar:1.00.03' in repository central (http://central)
    [INFO] ------------------------------------------------------------------------
    [ERROR] BUILD ERROR
    [INFO] ------------------------------------------------------------------------
    [INFO] Failed to resolve artifact.

    Missing:
    ----------
    1) com.example.app:example-app-module2:jar:1.00.03

      Try downloading the file manually from the project website.

      Then, install it using the command: 
          mvn install:install-file -DgroupId=com.example.app -DartifactId=example-app-module2 -Dversion=1.00.03 -Dpackaging=jar -Dfile=/path/to/file

      Alternatively, if you host your own repository you can deploy the file there: 
          mvn deploy:deploy-file -DgroupId=com.example.app -DartifactId=example-app-module2 -Dversion=1.00.03 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

      Path to dependency: 
            1) com.example.app:example-app-module3:module3:1.00.03
            2) com.example.app:example-app-module2:module2:1.00.03

    ----------
    1 required artifact is missing.

    for artifact: 
      com.example.app:example-app-module3:module3:1.00.03

      from the specified remote repositories:
      nexus (http://localhost:8081/nexus/content/groups/public)


    [INFO] ------------------------------------------------------------------------
    [INFO] For more information, run Maven with the -e switch
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 18 seconds
    [INFO] Finished at: Wed Apr 16 15:45:23 ADT 2014
    [INFO] Final Memory: 82M/247M
    [INFO] ------------------------------------------------------------------------

Parent Project's pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.example.app</groupId>
    <artifactId>example-app</artifactId>
    <version>1.00.03</version>
    <name>My Example Project</name>
    <packaging>pom</packaging>
    <modules>
     <module>app_module1</module>
     <module>app_module2</module>
     <module>app_module3</module>
     <module>app_module4</module>
     <module>app_module5</module>
    </modules>

After updating the following, below is the error I'm getting.

  1. Maven 2.2.1 to Maven 3.2.1
  2. Plugin, maven.site.plugin 2.1.1 to 3.3
  3. Extension, wagon-webdav-jackrabbit 2.5 to 2.6

Error Message:

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] My Example Project ................................ FAILURE [  3.719 s]
[INFO] Module1 ........................................... SKIPPED
[INFO] Module2 ........................................... SKIPPED
[INFO] Module3 ........................................... SKIPPED
[INFO] Module4 ........................................... SKIPPED
[INFO] Module5 ........................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.128 s
[INFO] Finished at: 2014-04-21T06:29:27-08:00
[INFO] Final Memory: 19M/51M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.3:deploy (default-deploy) on project example-app: Unsupported protocol: 'dav' for site deployment to distributionManagement.site.url=dav:http://localhost:8081/repo/content/sites/site/com.example.app/example-app/. -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Was it helpful?

Solution

I believe the problem is caused by the usage of maven-javadoc-plugin's aggregate report. When you run mvn deploy site-deploy as one command, the deploy and site-deploy lifecycles run in order on a per-module basis. As a result, the reactor module (the parent, as some say) runs deploy and then runs the site lifecycle (maven-site-plugin:3.3:site (default-site)) before any other modules have been compiled/installed/deployed (before their default lifecycle has been run). As you can see in the logs, the maven-javadoc-plugin runs the javadoc:aggregate (aka report:aggregate) goal, which proceeds to gather information from all the child modules. Unfortunately, since they haven't been built, the failure occurs.

This problem is especially pernicious when running release:perform, which executes the goals deploy site-deploy during the release, and does not allow for the option of running the deploy lifecycle to completion (across all modules) as a separate command before running the site-deploy lifecycle. In that case, you may want to change the preparationGoals option of release:prepare to clean install so that all modules will be installed before release:perform runs.

There is also a JIRA issue that appears to describe the problem: https://issues.apache.org/jira/browse/MJAVADOC-437 "javadoc:aggregate fails on initial build" A fix for it was included in version 2.10.4 of the plugin. However, it did not fix this issue when I tried using it.

OTHER TIPS

Here the answear directly from Maven docs:

A site must be generated first before executing site:deploy.

mvn site:deploy

If you want to generate the site and deploy it in one go, you can utilize the site-deploy phase of the site lifecycle. To do this, just execute:

mvn site-deploy

There must a different problem lurking.

mvn site:deploy 

is a call to the site plugin invoking the deploy goal.

Running

mvn site-deploy 

on the other hand calls the site-deploy lifecycle phase of the site lifecycle. It will automatically build the site running the site:site goal and then deploy it.

You will have to supply some more info from the build log to see what the actual problem is.

For starters I would ensure that

mvn deploy

works.

Then try

mvn site

and let us know.

And check out the documentation for more detailed pointers.

Also looking at the logs it seems like something is wrong with your dependency declarations between the projects. Is the source for this project available somewhere?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top