首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Github作为Maven存储库

Github作为Maven存储库
EN

Stack Overflow用户
提问于 2016-07-20 22:19:29
回答 0查看 1.3K关注 0票数 0

我正在尝试使用一个私有的Github存储库作为Maven存储库,遵循本页面上的说明:Hosting a Maven Repository in Github

我能够正确地部署,并且我可以看到工件(jars、poms等)。部署到Github代码库。

不起作用的是使用这个存储库来提取依赖项。在日志中,我可以看到pom正在尝试下载,但失败了。

代码语言:javascript
复制
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://raw.githubusercontent.com/ORGANIZATION/mvn-repo/master/ with username=randymay, password=***
Downloading: https://raw.githubusercontent.com/ORGANIZATION/mvn-repo/master/org/hibernate/hibernate/3.2.7.patched/hibernate-3.2.7.patched.pom
[WARNING] The POM for org.hibernate:hibernate:jar:3.2.7.patched is missing, no dependency information available

如果我在curl请求中使用该URL (具有基本身份验证),我就能够下载pom。

代码语言:javascript
复制
curl -v https://randymay:*****@raw.githubusercontent.com/ORGANIZATION/mvn-repo/master/org/hibernate/hibernate/3.2.7.patched/hibernate-3.2.7.patched.pom

在日志中,它实际上是在尝试下载jar:

代码语言:javascript
复制
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://raw.githubusercontent.com/ORGANIZATION/mvn-repo/master/ with username=randymay, password=***
Downloading: https://raw.githubusercontent.com/ORGANIZATION/mvn-repo/master/org/hibernate/hibernate/3.2.7.patched/hibernate-3.2.7.patched.jar
Could not find artifact org.hibernate:hibernate:jar:3.2.7.patched in github (https://raw.githubusercontent.com/ORGANIZATION/mvn-repo/master/)

下面是我的pom.xml的存储库部分:

代码语言:javascript
复制
<repositories>
    <!-- Repositories -->
    <repository>
        <id>github</id>
        <url>https://raw.githubusercontent.com/ORGANIZATION/mvn-repo/master/</url>
        <snapshots>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
        </snapshots>
        <releases>
            <enabled>true</enabled>
            <updatePolicy>never</updatePolicy>
        </releases>
    </repository>
</repositories>

下面是我在settings.xml中的服务器条目:

代码语言:javascript
复制
<server>
    <id>github</id>
    <username>randymay</username>
    <password>*****</password>
</server>

请注意,在参考文章中,他们使用了'raw.github.com‘域。我一开始试过了,也遇到了同样的问题。当我使用curl连接到该域时,我收到了一个'moved permanently‘错误。我使用的是'raw.githubusercontent.com‘,因为这是我能够成功使用curl的url。如果这不正确,请让我知道。

任何帮助都将不胜感激。提前谢谢。

EN

回答

页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38483847

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档