2013-05-27 3 views
3

Я пытался настроить развертывание в локальном хранилище:Maven. Repository аутентификации

- settings.xml -

<server> 
    <id>myrepo</id> 
    <username>deployer</username> 
    <password>123456</password> 
</server> 

- pom.xml ---

<repositories> 
    <repository> 
     <id>myrepo</id> 
     <url>http://myserver.com/artifactory/libs-release-local</url> 
     <releases> 
      <enabled>true</enabled> 
      <updatePolicy>always</updatePolicy> 
     </releases> 
     <snapshots> 
      <enabled>false</enabled> 
      <updatePolicy>always</updatePolicy> 
     </snapshots> 
    </repository> 
</repositories> 

, когда я выполняю «MVN развернуть»Я получил сообщение об ошибке:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.4: 
deploy (default-deploy) on project xxx: Failed to deploy artifacts: Co 
uld not transfer artifact xxx:xxx:war:0.1-20130527.121430-3 from/to myserver.com 
(http://myserver.com:8083/artifactory/libs-snapshot-local): Failed to transfer file: 
http://myserver.com:8083/artifactory/libs-snapshot-local/xxx/0.1-SNAPSHOT 
/xxx-0.1-20130527.121430-3.war. Return code is: 401 

журнал Artifactory:

2013-05-27 16:14:38,158 [DENIED DEPLOY] libs-snapshot-local:xxx/0.1-SNAPSHOT 
/xxx-0.1-20130527.121430-3.pom for anonymous/192.168.6.36. 

Если я изменил идентификатор сервера/репозитория на «myserver.com» - разверните WORK! Но это меня не устраивает, потому что это не сработало с помощью svn на myserver.com

Я попытался добавить теги «profile» и «mirror» to server.xml и «distributionManagement» to pom.xml - получение такая же ошибка

Идентификатор сервера/репозитория должен быть назван ТОЛЬКО как мой сервер?

Update1:

я удалить тег 'хранилищами' из pom.xml и добавил тег 'distributionManagment':

--- pom.xml ---

<distributionManagement> 
    <repository> 
     <id>myrepo</id> 
     <name>myrepo</name> 
     <url>http://myserver.com/artifactory/libs-release-local</url> 
    </repository> 
    <snapshotRepository> 
     <id>myrepo</id> 
     <name>myrepo</name> 
     <url>http://myserver.com/artifactory/libs-snapshots-local</url> 
     <uniqueVersion>false</uniqueVersion> 
    </snapshotRepository> 
</distributionManagement> 

(server.xml не изменился) - получение той же ошибки «Не удалось установить ...»

UPDATE2:

Постарайся ...

--- server.xml ---

<profiles> 
    <profile> 
     <id>artifactory</id> 
     <repositories> 
      <repository> 
       <snapshots> 
        <enabled>false</enabled> 
       </snapshots> 
       <id>central</id> 
       <name>libs-release</name> 
       <url>http://myserver.com/artifactory/libs-release-local</url> 
      </repository> 
      <repository> 
       <snapshots /> 
       <id>snapshots</id> 
       <name>libs-snapshot</name> 
       <url>http://myserver.com/artifactory/libs-snapshot-local</url> 
      </repository> 
     </repositories> 
    </profile> 
</profiles> 

<activeProfiles> 
    <activeProfile>artifactory</activeProfile> 
</activeProfiles> 

<server> 
    <id>snapshots</id> 
    <username>deployer</username> 
    <password>123456</password> 
</server> 
<server> 
    <id>central</id> 
    <username>deployer</username> 
    <password>123456</password> 
</server> 

--- pom.xml ---

<distributionManagement> 
    <repository> 
     <id>central</id> 
     <name>Internal Releases</name> 
     <url>http://myserver.com/artifactory/libs-release-local</url> 
    </repository> 
    <snapshotRepository> 
     <id>snapshots</id> 
     <name>Internal Snapshots</name> 
     <url>http://myserver.com/artifactory/libs-snapshots-local</url> 
     <uniqueVersion>false</uniqueVersion> 
    </snapshotRepository> 
</distributionManagement> 

выполнить 'МВН развернуть' - снова ошибка :(

Failed to deploy artifacts: Could not transfer artifact xxx:xxx:war:0.1-20130528.050526-1 from/to snapshots (http://myserver.com/artifactory/libs-snapshots-local) 

ответ

2

Тег 'репозиториев' является u sed для разрешения, а не для развертывания. Я бы предположил, что идентификатор репозитория под тегом «distributionManagment» является «myserver.com», поэтому он соответствует объявлению сервера в settings.xml

+2

Существует также уникальная версия false, которая не поддерживается в maven 3 , –

Смежные вопросы