我试图为我的Google App Engine项目添加guice。我使用Maven和Eclipse。在Eclipse中,我根据http://mvnrepository.com/artifact/com.google.inject/guice/3.0将以下内容添加到<dependencies>
元素中来修改我的pom.xml:
<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 =&gt;更新项目。但我仍然得到相同的4个错误。我也试过Project =&gt;干净又相同。
如何根据我的设置正确添加Guice?
答案 0 :(得分:0)
我可以通过转到命令行并发出命令mvn clean install
来解决此错误。 Maven从Maven Central Repository获取guice库毫无困难。然后我回到Eclipse并右键单击我的项目并选择Maven =&gt;更新项目。
这解决了我看到的所有错误,让Eclipse感到高兴。