Maven部署错误

时间:2012-04-02 09:09:07

标签: maven deployment

我有几个模块的maven项目。需要将所有模块( jars 和一个结果 war )部署到远程Artifactory服务器中。 所以在settings.xml中我添加了config:

<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <servers>
    <server>
      <username>admin</username>
      <password>password</password>
      <id>central</id>
    </server>
    <server>
      <username>admin</username>
      <password>password</password>
      <id>snapshots</id>
    </server>
  </servers>
  <profiles>
    <profile>
      <repositories>
        <repository>
           <id>central</id>
          <name>libs-release</name>
          <url>http://192.168.1.120:8088/artifactory/libs-release</url>
        </repository>
        <repository>
          <snapshots />
          <id>snapshots</id>
          <name>libs-snapshot</name>
          <url>http://192.168.1.120:8088/artifactory/libs-snapshot</url>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>central</id>
          <name>plugins-release</name>
          <url>http://192.168.1.120:8088/artifactory/plugins-release</url>
        </pluginRepository>
        <pluginRepository>
          <snapshots />
          <id>snapshots</id>
          <name>plugins-snapshot</name>
          <url>http://192.168.1.120:8088/artifactory/plugins-snapshot</url>
        </pluginRepository>
      </pluginRepositories>
      <id>artifactory</id>
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>artifactory</activeProfile>
  </activeProfiles>
</settings>

主要有pom部分:

<distributionManagement>
    <repository>
      <id>central</id>
      <url>http://192.168.1.120:8088/artifactory/libs-release-local</url>
    </repository>
    <snapshotRepository> 
        <id>snapshots</id>         
        <url>http://192.168.1.120:8088/artifactory/libs-snapshot-local</url> 
    </snapshotRepository>
  </distributionManagement>

所有模块都有1.0-SNAPSHOT版本。 但是在执行命令>mvn deploy时,发生了以下错误:

  

[错误]无法执行目标   org.apache.maven.plugins:行家 - 部署 - 插件:2.5:部署   项目工作(默认部署):无法部署工件:可以   不转移工件* project-name:project-nam * e:pom:0.0.1 from / to central   (http://192.168.1.120:8088/artifactory/libs-release-local):失败   转移文件:   http://192.168.1.120:8088/artifactory/libs-release-local/project-name/project-name/0.0.1/project-name-0.0.1.pom。   返回码为:401 - &gt; [帮助1]

如何处理?

更新

好的,我明白了。 401错误说:401 =“未经授权”。所以我在settings.xml中添加了正确的用户名/密码。现在似乎工作。

最后一个问题:是不是我在版本中使用了SNAPSHOT后缀?当我需要将所有模块部署到远程仓库时,情况是否适当?当一个模块被打破并且我的同事需要使用此模块的先前版本时,如何处理情况?

1 个答案:

答案 0 :(得分:2)

可能是因为它写得不正确。 您可以将其更改为http,然后重试。

相关问题