我尝试设置部署到本地存储库:
-- 设置.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 deploy”时出现错误:
[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
神器日志:
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.
如果我将服务器/存储库 ID 更改为“myserver.com” - 部署 WORK!但它不适合我,因为在 myserver.com 上使用 svn 插件更改日志不起作用
我尝试将标签“profile”和“mirror”添加到 server.xml 并将“distributionManagement”添加到 pom.xml - 得到相同的错误
服务器/存储库 ID 必须仅命名为我的服务器?
更新1:
我从 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 没有改变) - 得到同样的错误“部署失败......”
更新2:
尝试...
--- 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>
执行'mvn deploy' - 再次错误:(
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)