2011-10-11 35 views
3

我刚刚阅读了Guava,并查看了它的源代码,但不知道如何构建它以便使用。我使用“mvn package”构建了jar文件,但它产生了Guava GWT的错误。使用Maven“mvn package”无法构建番石榴

[ERROR] Failed to execute goal on project guava-gwt: Could not resolve dependenc 
ies for project com.google.guava:guava-gwt:jar:latest: Failure to find com.googl 
e.guava:guava:jar:sources:latest in http://repo1.maven.org/maven2 was cached in 
the local repository, resolution will not be reattempted until the update interv 
al of central has elapsed or updates are forced -> [Help 1] 
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit 
ch. 
[ERROR] Re-run Maven using the -X switch to enable full debug logging. 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please rea 
d the following articles: 
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyReso 
lutionException 
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command 

enter image description here

回答

5

您可能需要运行 “MVN安装” 首先,作为查尔斯·弗莱在这里解释:

http://groups.google.com/group/guava-discuss/browse_thread/thread/aac1ec01dc09f363

We have a funny setup where you have to build stuff using 'mvn install' before the other obvious stuff works.


你也可以取决于最新版本使用Maven依赖关系,如果你不关心TRUNK:

is guava-libraries available in maven repo?

+0

现在我得到这个错误: [错误]未能执行目标org.apache.maven.plugins:Maven的万无一失-插件:2。 7.2:项目guava-test上的测试(默认测试):测试失败。 [错误] [错误]请参考D:\ Guava \ guava-tests \ target \ surefire-reports了解个别测试结果。 – Emerald214

+0

target/surefire-reports的内容是什么?这可能会给我们提供有关问题的线索。 Guava测试套件最近开放源代码,从TRUNK构建测试有时会失败(在这种情况下,我们将在Guava跟踪器上打开一个问题)。您可以执行“mvn clean install -Dmaven.test.skip”以忽略现在的测试。也就是说,你确定你想依赖TRUNK而不是最新版本的jar吗? –

+0

好吧,我会下载并使用释放jar而不是使用trunk。 Guava-r09已弃用,但我认为可以使用。 – Emerald214