我设法将我的maven jar托管在我的私人仓库中(至少这是我看到的)。
https://repository-{my-library}.forge.cloudbees.com/snapshot/
当我从浏览器访问它时,文件夹' org'显示和浏览我可以看到XML和jar。
问题是当我尝试将jar用于我的应用程序时,我收到此错误:
Downloading: http://repository-{my-library}.forge.cloudbees.com/release/org/{my-library}/{my-library}/0.0.1-SNAPSHOT/maven-metadata.xml
Downloading: https://raw.github.com/{my-library}/spring-boot-legacy/mvn-repo/org/{my-library}/{my-library}/0.0.1-SNAPSHOT/maven-metadata.xml
[WARNING] Could not transfer metadata org.{my-library}:{my-library}:0.0.1-SNAPSHOT/maven-metadata.xml from/to {my-library}-snapshot (http://repository-{my-library}.forge.cloudbees.com/release/): Not authorized , ReasonPhrase:Unauthorized.
[WARNING] Failure to transfer org.{my-library}:{my-library}:0.0.1-SNAPSHOT/maven-metadata.xml from http://repository-{my-library}.forge.cloudbees.com/release/ was cached in the local repository, resolution will not be reattempted until the update interval of {my-library}-snapshot has elapsed or updates are forced. Original error: Could not transfer metadata org.{my-library}:{my-library}:0.0.1-SNAPSHOT/maven-metadata.xml from/to {my-library}-snapshot (http://repository-{my-library}.forge.cloudbees.com/release/): Not authorized , ReasonPhrase:Unauthorized.
我不明白为什么我可以从浏览器访问repo快照,但maven说" Unauthorized"?
答案 0 :(得分:1)
您需要将自定义 settings.xml 添加到您的私有存储库,安装它并从那里加载配置。否则,您将无法访问(受保护的)工件。
文档隐藏得很好,但您可以在此处找到它:http://developer.cloudbees.com/bin/view/DEV/Accessing+under+an+external+Maven+repository