Search code examples
javagitmavengithubguava

Can't find Guava 20.0-SNAPSHOT artifact


I have a project hosted on GitHub, with a branch I'm using for developing a new version: https://github.com/jrtom/jung/tree/common.graph

The master branch (v2.1.1) builds fine.

The common.graph branch differs from master in only two ways:

  1. I've bumped the version in the pom.xml files from 2.2-SNAPSHOT to 3.0-SNAPSHOT. This is effectively cosmetic.
  2. I've bumped the Guava dependency version from 19.0 to 20.0-SNAPSHOT, so that I can start developing against the new features. This is the correct dependency per the Guava documentation: https://github.com/google/guava#snapshots

A pull request of the common.graph branch successfully builds via Travis: https://github.com/jrtom/jung/pull/65

However, when I clone this branch:

git clone --branch common.graph --single-branch [email protected]:jrtom/jung.git jung_3.0

and then run mvn install, I get this error:

Failed to execute goal on project jung-api: 
Could not resolve dependencies for project net.sf.jung:jung-api:jar:3.0-SNAPSHOT:
Could not find artifact com.google.guava:guava:jar:20.0-SNAPSHOT

Blowing away the local repository under ~/.m2/repository has no effect.

As far as I can tell--from reading Maven documentation, from looking at other pom.xml files that reference Guava's snapshot of v20--this change should Just Work, but it doesn't.

Changing the Guava dependency to 18.0 does work. So it seems like something wacky with the -SNAPSHOT specification, but I don't see how.

Any advice/pointers would be appreciated.

UPDATE:

@RC.'s response below pointed me in the correct direction, although I still needed to figure out the right repository spec for Google snapshots. For future reference, here's the spec:

<repositories>
  <repository>
    <id>google-snapshots</id>
    <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
    <releases>
      <enabled>false</enabled>
    </releases>
    <snapshots>
      <enabled>true</enabled>
    </snapshots>
  </repository>
</repositories>

Solution

  • Snapshots are not pushed in maven central for obvious reasons.

    If you really want guava snapshots, it seems they are pushed in this repository

    To add a custom repository to your pom, use something like (adapted from the doc):

      <repositories>
        <repository>
          <releases>
            <enabled>false</enabled>
            <updatePolicy>always</updatePolicy>
            <checksumPolicy>warn</checksumPolicy>
          </releases>
          <snapshots>
            <enabled>true</enabled>
            <updatePolicy>never</updatePolicy>
            <checksumPolicy>fail</checksumPolicy>
          </snapshots>
          <id>sonatype-OSS-snaphots</id>
          <name>Sonatype OSS Snapshots</name>
          <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
          <layout>default</layout>
        </repository>
      </repositories>