Maven 部署失败?

标签 maven maven-3 pom.xml archiva

你好,
我使用存档创建了新的 Maven Artifact ,以便与我的团队共享更新的 jar 项目。当我尝试部署项目时,我失败了:

downloading: http://**VirtualMachineName:8888/groupId**/webInfra/0.0.1-SNAPSHOT/maven-metadata.xml
[WARNING] Could not transfer metadata **groupId**:webInfra:0.0.1-SNAPSHOT/maven-metadata.xml from/to stmaven (http://**VirtualMachineName:8888**): Failed to transfer http://**VirtualMachineName:8888/groupId**/webInfra/0.0.1-SNAPSHOT/maven-metadata.xml. Error code 504, Proxy Timeout ( The connection timed out.  )
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:05 min
[INFO] Finished at: 2016-03-08T10:04:00+02:00
[INFO] Final Memory: 14M/249M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project webInfra: Failed to retrieve remote metadata il.co.stms-automation:webInfra:0.0.1-SNAPSHOT/maven-metadata.xml: Could not transfer metadata **groupId**:webInfra:0.0.1-SNAPSHOT/maven-metadata.xml from/to stmaven (http://VirtualMachineName:8888): Failed to transfer http://**VirtualMachineName:8888/groupId**/webInfra/0.0.1-SNAPSHOT/maven-metadata.xml. Error code 504, Proxy Timeout ( The connection timed out.  ) -> [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

this what I added to pom.xml file:

    <repository>
      <id>stmaven</id>
      <name>stmaven</name>
      <url>http://stmaven:8888</url>
    </repository>


 what added to setting.xml file:
<servers>

    <server>
      <id>VirtualMachineName</id>
      <username>user</username>
      <password>pass</password>
    </server>
    <!---->


  </servers>


  <mirrors>

    <mirror>
      <id>mirrorId</id>
      <mirrorOf>archiva</mirrorOf>
      <name>maven archiva Mycompany</name>
      <url>http://VirtualMachineName:8888/#browse/**groupId**</url>
    </mirror>

  </mirrors>

注意:我对创建和维护 maven 存储库很陌生。

谢谢

最佳答案

您必须在 POM 中声明以下参数:

<distributionManagement>

    <repository>
        <id>releases</id>
        <name>Releases</name>
        <url>http://localHost:8080/repository/YourRepo/</url>
    </repository>

    <snapshotRepository>
        <id>snapshots</id>
        <name>Snapshots</name>
        <url>http://localHost:8080/repository/YourRepo/</url>
    </snapshotRepository>
</distributionManagement>

Both repository (release and snapshots ) point in same repo in archiva

Snapshot option should be enabled on YourRepo in archiva



您必须在设置 XML 中声明以下参数:
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                  http://maven.apache.org/xsd/settings-1.0.0.xsd">
 <servers>
<server>
  <id>YourRepo</id>
  <username>admin</username>
  <password>password</password>
</server>
<server>
  <id>releases</id>
  <username>admin</username>
  <password>password</password>
</server>
</servers>
</settings>

之后你可以运行:mvn deploy
这个对我有用

关于Maven 部署失败?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35862608/

相关文章:

java - Eclipse、Maven 和 Spring Roo 1.2.4.RELEASE : Missing artifact org. springframework.roo :org. springframework.roo.annotations:jar

maven - 如何根据依赖关系列出 Maven 构建/编译序列?

maven - 从 gradle 导出 Maven pom.xml 文件时注入(inject)构建 block 时遇到问题

java - 如何在 Eclipse IDE 中调试 drools (.drl) 文件

java - 使用tortoise svn在maven中更新源代码

java - 根据其他属性的存在设置 Maven 属性

java - java中pom.xml文件有什么用?

java - 使用 Azure 构建管道时,从 JaCoCo 中排除多模块 Maven 项目中的测试目录

java - 以编程方式将 Eclipse 插件项目转换为 Maven 项目

java - Maven 3 : Failed to execute goal org. apache.maven.plugins :maven-archetype-plugin:2. 2:生成