我运行" mvn deploy site-deploy"时无法解决工件问题。如果我拆分命令" mvn deploy"然后" mvn site-deploy"

时间:2014-04-16 21:35:34

标签: maven nexus

运行 mvn deploy site-deploy 时,

构建失败。但是当我拆分命令时工作正常。即,首先, mvn deploy ,然后 mvn site-deploy

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

我们正在使用

  1. Maven 2.2.1和Sonatype Nexus 2.7.2。
  2. maven.site.plugin 2.1.1和wagon-webdav-jackrabbit 2.5在我们的pom文件中。
  3. 非常感谢任何建议或意见。谢谢!!! :)


    我们的项目包含5个子模块。它说无法解决工件版本1.00.03。但是,它所说的缺失的工件是目前正在建造的工件。

    构建日志:

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

    更新以下内容后,下面是我得到的错误。

    1. Maven 2.2.1 to Maven 3.2.1
    2. 插件,maven.site.plugin 2.1.1至3.3
    3. Extension,wagon-webdav-jackrabbit 2.5 to 2.6
    4. 错误讯息:

      [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
      

3 个答案:

答案 0 :(得分:1)

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

此问题在运行release:perform时特别有害,deploy site-deploy在发布期间执行目标deploy,并且不允许运行site-deploy生命周期的选项完成(所有模块)作为运行preparationGoals生命周期之前的单独命令。在这种情况下,您可能希望将release:prepare的{​​{1}}选项更改为clean install,以便在release:perform运行之前安装所有模块。

还有一个JIRA问题似乎描述了这个问题:https://issues.apache.org/jira/browse/MJAVADOC-437“javadoc:聚合在初始构建时失败”它的修复程序包含在插件的2.10.4版本中。但是,当我尝试使用它时,它没有解决这个问题。

答案 1 :(得分:0)

这里直接来自Maven docs的answear:

在执行site:deploy之前,必须先生成一个站点。

mvn site:deploy

如果要生成站点并一次性部署,则可以利用站点生命周期的站点部署阶段。为此,只需执行:

mvn site-deploy

答案 2 :(得分:0)

潜伏着一个不同的问题。

mvn site:deploy 

是对调用部署目标的站点插件的调用。

运行

mvn site-deploy 
另一方面,

调用站点生命周期的站点部署生命周期阶段。它将自动构建运行站点的站点:站点目标,然后进行部署。

您必须从构建日志中提供更多信息,以查看实际问题。

对于初学者,我会确保

  

mvn deploy

作品。

然后尝试

  

mvn site

告诉我们。

并查看the documentation以获取更详细的指示。

同样查看日志,似乎项目之间的依赖声明存在问题。该项目的来源是否可用?