2015-02-10 56 views
0

我试图将guice添加到我的Google App Engine项目中。我使用Maven和Eclipse。在Eclipse中,我修改了我的pom.xml中加入下面的<dependencies>元素按http://mvnrepository.com/artifact/com.google.inject/guice/3.0当添加guice时出现eclipse错误ArtifactTransferException

<dependency> 
    <groupId>com.google.inject</groupId> 
    <artifactId>guice</artifactId> 
    <version>3.0</version> 
</dependency> 

然而,Eclipse已经提出了四个错误:

Description Resource Path Location Type 
ArtifactTransferException: Failure to transfer com.google.inject:guice:jar:3.0 from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact com.google.inject:guice:jar:3.0 from/to central (http://repo.maven.apache.org/maven2): connect timed out pom.xml /audiencemarketing-backend line 123 Maven Dependency Problem 

Description Resource Path Location Type 
Missing artifact com.google.inject:guice:jar:3.0 pom.xml /audiencemarketing-backend line 1 Maven Dependency Problem 

Description Resource Path Location Type 
The container 'Maven Dependencies' references non existing library '/Users/mosofsky/.m2/repository/com/google/inject/guice/3.0/guice-3.0.jar' audiencemarketing-backend  Build path Build Path Problem 

Description Resource Path Location Type 
The project cannot be built until build path errors are resolved audiencemarketing-backend  Unknown Java Problem 

我曾尝试用鼠标右键单击我的项目并选择Maven =>更新项目。但我仍然得到相同的4个错误。我也尝试过Project => Clean和同样的事情。

如何正确添加Guice给定我的设置?

回答

0

我能够通过转到我的命令行并发出命令mvn clean install来解决此错误。 Maven从Maven Central Repository获取guice库并不困难。然后我回到Eclipse并右键单击我的项目并选择Maven => Update Project。

这解决了我所看到的所有错误,并使Eclipse开心。