我曾尝试使用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:\Users\watrous\.m2\repository\com\github\cache4guice\0.1\cache4guice-0.1.jar; error in opening zip file我检查了一下,jar文件看起来确实是假的。我不能用zip工具打开它,它的大小比存储库中的略大。
你知道我哪里出错了吗,或者为什么maven得到的文件看起来是假的?
发布于 2013-05-24 00:08:46
事实证明这很简单。我只需要将存储库声明更改为引用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>我仍然得到一个校验和问题,但所有的文件都可以正常下载,我可以构建。
https://stackoverflow.com/questions/16718263
复制相似问题