2015-02-10 12 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開心。