Adam Paynter
Adam Paynter

Reputation: 46938

How do I run Guava's unit tests?

I have cloned Guava's repository via the following command:

git clone https://code.google.com/p/guava-libraries/

Because I am not entirely familiar with Guava's structure, I tried the following commands:

cd guava-libraries
mvn test

Unfortunately, I received the following error (the entire output is available viewed here).

[INFO] ------------------------------------------------------------------------
[INFO] Building Guava GWT compatible libs
[INFO]    task-segment: [test]
[INFO] ------------------------------------------------------------------------
Downloading: https://oss.sonatype.org/content/repositories/snapshots/com/google/guava/guava/13.0-SNAPSHOT/guava-13.0-SNAPSHOT-sources.jar
[INFO] Unable to find resource 'com.google.guava:guava:jar:sources:13.0-SNAPSHOT' in repository sonatype-nexus-snapshots (https://oss.sonatype.org/content/repositories/snapshots)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

Missing:
----------
1) com.google.guava:guava:jar:sources:13.0-SNAPSHOT

  Try downloading the file manually from the project website.

  Then, install it using the command: 
      mvn install:install-file -DgroupId=com.google.guava -DartifactId=guava -Dversion=13.0-SNAPSHOT -Dclassifier=sources -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file there: 
      mvn deploy:deploy-file -DgroupId=com.google.guava -DartifactId=guava -Dversion=13.0-SNAPSHOT -Dclassifier=sources -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

  Path to dependency: 
    1) com.google.guava:guava-gwt:jar:13.0-SNAPSHOT
    2) com.google.guava:guava:jar:sources:13.0-SNAPSHOT

----------
1 required artifact is missing.

for artifact: 
  com.google.guava:guava-gwt:jar:13.0-SNAPSHOT

from the specified remote repositories:
  central (http://repo1.maven.org/maven2),
  sonatype-nexus-snapshots (https://oss.sonatype.org/content/repositories/snapshots)

How do I run Guava's unit tests?

Upvotes: 1

Views: 799

Answers (2)

Mark O'Connor
Mark O'Connor

Reputation: 77991

Why use a snapshot revision when a release candidate is available from Maven Central?

<dependency>
    <groupId>com.google.guava</groupId>
    <artifactId>guava</artifactId>
    <version>13.0-rc2</version>
</dependency>

Upvotes: 0

Andrzej Jozwik
Andrzej Jozwik

Reputation: 14649

You can not run just mvn test before complete installation to local repository. Please run first time:

mvn clean install

Then you can run only mvn test. SNAPSHOT's libraries are not available yet in repository.

Upvotes: 3

Related Questions