Jenkinsでビルド~Archivaにリポジトリ登録
Jenkinsビルド後のmvn deployで、Archivaのリポジトリに登録する際にエラーが発生。
------------------ [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] Error deploying artifact: Failed to transfer file: http://mydomain/archiva/repository/xxx/common.pom. Return code is: 401 Unauthorized
やったこと。
- Archivaのリポジトリ作成、ユーザ作成、アップロード権限付与
- pom.xmlの設定(下記、 Deploying to Repository参照)
- settings.xmlの設定(←これが間違っていた。$MAVEN_HOME/conf/settings.xmlの方をいじっていた。。)
- Jenkinsのジョブ実行。デプロイ時にエラー。
対応:Jenkins起動ユーザ(jenkins)の$JENKINS_HOME/.m2/settings.xmlを作成して、正しい認証情報を記述
参考:http://archiva.apache.org/docs/1.0.1/userguide/deploy.html
Deploying to Repository
Deploying to Archiva using WebDAV
- Configure the distributionManagement part of your pom.xml (customising the URLs as needed)
<project> ... <distributionManagement> <repository> <id>archiva.internal</id> <name>Internal Release Repository</name> <url>dav:http://reposerver.mycompany.com:8080/archiva/repository/internal/</url> </repository> <snapshotRepository> <id>archiva.snapshots</id> <name>Internal Snapshot Repository</name> <url>dav:http://reposerver.mycompany.com:8080/archiva/repository/snapshots/</url> </snapshotRepository> </distributionManagement> ... </project>
- Add a build extension to your pom.xml
- Finally the user that is running archiva (tomcat-user, plexus-user,..) must have write access to the deployment repository.
参考:http://www.seasar.org/wiki/index.php?Maven2DeployToRepoRemoteWithWebDAV#n5b91412