我尝试使用github作为我在那里托管的项目的maven存储库,但我有一些问题让它工作。首先,项目如下:
https://github.com/dwatrous/cache4guice我创建了一个分支'mvn-repo'来保存maven的发布文件。我按照这个过程为这个分支创建maven文件:
http://blog.rueedlinger.ch/2012/09/use-github-as-maven-remote-repository/我已经确认文件在那里。然后,我将它添加到使用cache4guice库的项目的pom.xml中:
<repository>
<id>com.github.cache4guice</id>
<url>https://github.com/dwatrous/cache4guice/tree/mvn-repo</url>
<!-- use snapshot version -->
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
和
<dependency>
<groupId>com.github</groupId>
<artifactId>cache4guice</artifactId>
<version>0.1</version>
</dependency>
当我构建时,我得到以下错误:
Downloading: https://github.com/dwatrous/cache4guice/tree/mvn-repo/com/github/cache4guice/0.1/cache4guice-0.1.pom
Checksum validation failed, expected <!DOCTYPE but is 6ca9a53135148bf33e1b08aadc611b65489b4991 for https://github.com/dwatrous/cache4guice/tree/mvn-repo/com/github/cache4guice/0.1/cache4guice-0.1.pom
Checksum validation failed, expected <!DOCTYPE but is 57e202c6b25139da08d065550ebd8c50d9f7d162 for https://github.com/dwatrous/cache4guice/tree/mvn-repo/com/github/cache4guice/0.1/cache4guice-0.1.pom
Downloaded: https://github.com/dwatrous/cache4guice/tree/mvn-repo/com/github/cache4guice/0.1/cache4guice-0.1.pom (38 KB at 2.7 KB/sec)
The POM for com.github:cache4guice:jar:0.1 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
Downloading: http://morphia.googlecode.com/svn/mavenrepo/com/github/cache4guice/0.1/cache4guice-0.1.jar
Downloading: https://github.com/dwatrous/cache4guice/tree/mvn-repo/com/github/cache4guice/0.1/cache4guice-0.1.jar
Checksum validation failed, expected <!DOCTYPE but is 12bd0042aad0971621728f9ba3c048106ef8a84e for https://github.com/dwatrous/cache4guice/tree/mvn-repo/com/github/cache4guice/0.1/cache4guice-0.1.jar
Checksum validation failed, expected <!DOCTYPE but is 1506b45c11f00ba484462660f61a83ac14620761 for https://github.com/dwatrous/cache4guice/tree/mvn-repo/com/github/cache4guice/0.1/cache4guice-0.1.jar
Downloaded: https://github.com/dwatrous/cache4guice/tree/mvn-repo/com/github/cache4guice/0.1/cache4guice-0.1.jar (23 KB at 4.7 KB/sec)
最后是:
COMPILATION ERROR :
-------------------------------------------------------------
error: error reading C:Userswatrous.m2repositorycomgithubcache4guice .1cache4guice-0.1.jar; error in opening zip file
我检查了,jar文件似乎是假的。我无法用zip工具打开它,并且它的大小略大于存储库中的大小。
有没有人知道我哪里出错了,或者为什么文件maven似乎是假的?
事实证明这很简单。我只需要将存储库声明更改为引用raw.github.com,如下所示:
<repository>
<id>com.github.cache4guice</id>
<url>https://raw.github.com/dwatrous/cache4guice/mvn-repo</url>
<!-- use snapshot version -->
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
我仍然得到一个校验和问题,但所有的文件都下载正常,我可以构建。