我通过以下命令克隆了Guava的存储库:
git clone https://code.google.com/p/guava-libraries/
因为我不完全熟悉Guava的结构,所以我尝试了以下命令:
cd guava-libraries mvn test
不幸的是,我收到了以下错误(整个输出可查看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)
如何运行Guava的单元测试?
答案 0 :(得分:3)
在完成安装到本地存储库之前,您无法运行mvn test。请第一次运行:
mvn clean install
然后您只能运行mvn test
。 SNAPSHOT的库尚未在存储库中提供。
答案 1 :(得分:0)
为什么在Maven Central提供候选版本时使用快照修订版?
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>13.0-rc2</version>
</dependency>