Search code examples
mavengithubrepositorychecksum

using github as maven repository Checksum validation failed


I've tried to use github as a maven repository for a project I host there, but I'm having some issues getting it to work. First off, here's the project:

https://github.com/dwatrous/cache4guice

I created a branch, 'mvn-repo', to hold the maven release files. I followed this process to create the maven files for that branch:

http://blog.rueedlinger.ch/2012/09/use-github-as-maven-remote-repository/

I have verified the files are up there. I then added this to the pom.xml for a project that uses the cache4guice library:

<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>

and

<dependency>
    <groupId>com.github</groupId>
    <artifactId>cache4guice</artifactId>
    <version>0.1</version>
</dependency>

When I build I get the following errors:

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)

And eventually this:

COMPILATION ERROR : 
-------------------------------------------------------------
error: error reading C:\Users\watrous\.m2\repository\com\github\cache4guice\0.1\cache4guice-0.1.jar; error in opening zip file

I checked and the jar file does appear to be bogus. I can't open it with a zip utility and the size is slightly larger than what is in the repository.

Any idea where I went wrong or why the file maven is getting seems to be bogus?


Solution

  • Turns out this was simple. I just needed to change the repository declaration to reference raw.github.com, like this:

    <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>
    

    I'm still getting a checksum issue, but all the files are downloading properly and I can build.