当我运行"mvn deploy site-deploy"时,无法解决工件但如果我将命令"mvn deploy"拆分为然后"mvn site-deploy" [英] 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"

查看:138
本文介绍了当我运行"mvn deploy site-deploy"时,无法解决工件但如果我将命令"mvn deploy"拆分为然后"mvn site-deploy"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我运行 mvn deploy site-deploy 时构建失败.但是当我拆分命令时,效果很好.即,首先, mvn部署,然后 mvn网站部署.

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.

这些年来,我们一直使用命令 mvn deploy site-deploy 来执行构建.我们最近迁移到了Sonatype Nexus存储库,而我们的第一个构建将失败.

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.

我们正在使用

  1. Maven 2.2.1和Sonatype Nexus 2.7.2.
  2. 我们的pom文件中的
  3. maven.site.plugin 2.1.1和wagon-webdav-jackrabbit 2.5.
  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!!! :)

我们的项目包含5个子模块.它说无法解析工件版本1.00.03.但是,它说缺少的工件是当前正在构建的工件.

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.

构建日志:

/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] ------------------------------------------------------------------------

父项目的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到Maven 3.2.1
  2. 插件,maven.site.plugin 2.1.1至3.3
  3. 扩展名,wagon-webdav-jackrabbit 2.5到2.6

错误消息:

[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

推荐答案

我认为问题是由使用maven-javadoc-plugin的汇总报告引起的.当您将mvn deploy site-deploy作为一个命令运行时,部署和站点部署生命周期将按模块顺序运行.结果,在编译,安装/部署任何其他模块之前,反应堆模块(有人说是父级)先运行deploy然后运行站点生命周期(maven-site-plugin:3.3:site(默认站点)). (在其默认生命周期已运行之前).如您在日志中所看到的,maven-javadoc-plugin运行javadoc:aggregate(又名report:aggregate)目标,该目标继续从所有子模块中收集信息.不幸的是,由于尚未构建,因此会发生故障.

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.

在运行release:perform时,此问题尤其严重,该问题在发行版中执行目标deploy site-deploy,并且不允许将deploy生命周期运行至完成(跨所有模块)作为单独的命令的选项在运行site-deploy生命周期之前.在这种情况下,您可能需要将release:preparepreparationGoals选项更改为clean install,以便在运行release:perform之前安装所有模块.

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.

还有一个JIRA问题似乎可以描述问题: https://issues .apache.org/jira/browse/MJAVADOC-437 "javadoc:aggregate在初始构建时失败".该插件的修补程序包含在版本2.10.4中.但是,当我尝试使用它时,并不能解决该问题.

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.

这篇关于当我运行"mvn deploy site-deploy"时,无法解决工件但如果我将命令"mvn deploy"拆分为然后"mvn site-deploy"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆