2016-08-18 129 views
0

我嘗試使用Spring,但在我的pom.xml中似乎存在一些問題,無法解決Spring依賴關係。項目在本地沒有解決的Maven中存在依賴關係(Spring-security依賴關係)

在pom.xml中,我有以下庫:

<repositories> 
    <repository> 
     <id>repository.springframework.maven.release</id> 
     <name>Spring Framework Maven Release Repository</name> 
     <url>http://maven.springframework.org/release</url> 
    </repository> 
</repositories> 

<!-- Spring Core framework --> 
     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-core</artifactId> 
      <version>4.3.2.RELEASE</version> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-web</artifactId> 
      <version>4.3.2.RELEASE</version> 
     </dependency> 
     <!-- Spring security framework --> 
     <dependency> 
      <groupId>org.springframework.security</groupId> 
      <artifactId>spring-security-web</artifactId> 
      <version>4.1.2.RELEASE</version> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework.security</groupId> 
      <artifactId>spring-security-config</artifactId> 
      <version>4.1.2.RELEASE</version> 
     </dependency> 

我總是有:無法解析項目依賴,下面的文物無法解析:

org.springframework.security:spring-security-web:jar:4.1.2.RELEASE 
aopalliance:aopalliance:jar:1.0 
org.springframework.security:spring-security-core:jar:4.1.2.RELEASE 
org.springframework:spring-expression:jar:4.3.1.RELEASE 
org.springframework.security:spring-security-config:jar:4.1.2.RELEASE 

即使我在pom.xml中使用另一個存儲庫,甚至刪除存儲庫以使用maven中的默認存儲庫,它也一樣,沒有任何改變。從Maven的

完整的錯誤消息:

Failed to execute goal on project Aegyptologie: Could not resolve dependencies for project de.unileipzig.wirote:Aegyptologie:war:0.1-SNAPSHOT: The following artifacts could not be resolved: org.springframework:spring-core:jar:4.3.2.RELEASE, org.springframework:spring-web:jar:4.3.2.RELEASE, org.springframework:spring-aop:jar:4.3.2.RELEASE, org.springframework:spring-beans:jar:4.3.2.RELEASE, org.springframework:spring-context:jar:4.3.2.RELEASE, org.springframework.security:spring-security-web:jar:4.1.2.RELEASE, aopalliance:aopalliance:jar:1.0, org.springframework.security:spring-security-core:jar:4.1.2.RELEASE, org.springframework:spring-expression:jar:4.3.1.RELEASE, org.springframework.security:spring-security-config:jar:4.1.2.RELEASE: Could not transfer artifact org.springframework:spring-core:jar:4.3.2.RELEASE from/to repository.springframework.maven.release (http://maven.springframework.org/release): Connection reset -> [Help 1] 

To see the full stack trace of the errors, re-run Maven with the -e switch. 
Re-run Maven using the -X switch to enable full debug logging. 

For more information about the errors and possible solutions, please read the following articles: 
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException 

我怎樣才能解決呢?

+0

你是在代理的後面嗎? –

+0

您能否提供來自Maven的完整錯誤消息? – Daniel

+0

@ A_Di-Matteo不,我不使用任何代理 –

回答

0

我可以建立沒有任何錯誤的項目。請查看日誌作爲證據:它看起來你是在代理之後運行。如果是的話,你需要修復apache-maven-3.x.x的conf/settings.xml文件。

$ mvn clean install -DskipTests 
[INFO] Scanning for projects... 
[INFO] 
[INFO] ------------------------------------------------------------------------ 
[INFO] Building Aegyptologie 0.1-SNAPSHOT 
[INFO] ------------------------------------------------------------------------ 
Downloading: https://mvnrepository.com/artifact/org.springframework/org/springframework/security/spring-security-web/4.1.2.RELEASE/spring-security-web-4.1.2.RELEASE.pom 
Downloading: https://repo.maven.apache.org/maven2/org/springframework/security/spring-security-web/4.1.2.RELEASE/spring-security-web-4.1.2.RELEASE.pom 
Downloaded: https://repo.maven.apache.org/maven2/org/springframework/security/spring-security-web/4.1.2.RELEASE/spring-security-web-4.1.2.RELEASE.pom (0 B at 0.0 KB/sec) 
Downloading: https://mvnrepository.com/artifact/org.springframework/org/springframework/security/spring-security-core/4.1.2.RELEASE/spring-security-core-4.1.2.RELEASE.pom 
Downloading: https://repo.maven.apache.org/maven2/org/springframework/security/spring-security-core/4.1.2.RELEASE/spring-security-core-4.1.2.RELEASE.pom 
Downloaded: https://repo.maven.apache.org/maven2/org/springframework/security/spring-security-core/4.1.2.RELEASE/spring-security-core-4.1.2.RELEASE.pom (0 B at 0.0 KB/sec) 
Downloading: https://mvnrepository.com/artifact/org.springframework/org/springframework/security/spring-security-web/4.1.2.RELEASE/spring-security-web-4.1.2.RELEASE.jar 
Downloading: https://mvnrepository.com/artifact/org.springframework/org/springframework/security/spring-security-core/4.1.2.RELEASE/spring-security-core-4.1.2.RELEASE.jar 
Downloading: https://repo.maven.apache.org/maven2/org/springframework/security/spring-security-web/4.1.2.RELEASE/spring-security-web-4.1.2.RELEASE.jar 
Downloading: https://repo.maven.apache.org/maven2/org/springframework/security/spring-security-core/4.1.2.RELEASE/spring-security-core-4.1.2.RELEASE.jar 
Downloaded: https://repo.maven.apache.org/maven2/org/springframework/security/spring-security-web/4.1.2.RELEASE/spring-security-web-4.1.2.RELEASE.jar (0 B at 0.0 KB/sec) 
Downloaded: https://repo.maven.apache.org/maven2/org/springframework/security/spring-security-core/4.1.2.RELEASE/spring-security-core-4.1.2.RELEASE.jar (0 B at 0.0 KB/sec) 
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ Aegyptologie --- 
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ Aegyptologie --- 
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent! 
[INFO] Copying 29 resources 
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ Aegyptologie --- 
[INFO] Changes detected - recompiling the module! 
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent! 
[INFO] Compiling 42 source files to e:\Advance Java\POI\Aegyptologie\target\classes 
[WARNING] /e:/Advance Java/POI/Aegyptologie/src/main/java/de/unileipzig/wirote/control/Encoding.java: e:\Advance Java\POI\Aegyptologie\src\main\java\de\unileipzig\wirote\control\Encoding.java uses unchecked or uns 
[WARNING] /e:/Advance Java/POI/Aegyptologie/src/main/java/de/unileipzig/wirote/control/Encoding.java: Recompile with -Xlint:unchecked for details. 
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ Aegyptologie --- 
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent! 
[INFO] skip non existing resourceDirectory e:\Advance Java\POI\Aegyptologie\src\test\resources 
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ Aegyptologie --- 
[INFO] No sources to compile 
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ Aegyptologie --- 
[INFO] Tests are skipped. 
[INFO] 
[INFO] --- maven-war-plugin:2.2:war (default-war) @ Aegyptologie --- 
[INFO] Packaging webapp 
[INFO] Assembling webapp [Aegyptologie] in [e:\Advance Java\POI\Aegyptologie\target\awv-seite] 
[INFO] Processing war project 
[INFO] Copying webapp resources [e:\Advance Java\POI\Aegyptologie\src\main\webapp] 
[INFO] Webapp assembled in [6184 msecs] 
[INFO] Building war: e:\Advance Java\POI\Aegyptologie\target\awv-seite.war 
[INFO] WEB-INF\web.xml already added, skipping 
[INFO] 
[INFO] --- maven-install-plugin:2.4:install (default-install) @ Aegyptologie --- 
[INFO] Installing e:\Advance Java\POI\Aegyptologie\target\awv-seite.war to C:\Users\prateek\.m2\repository\de\unileipzig\wirote\Aegyptologie\0.1-SNAPSHOT\Aegyptologie-0.1-SNAPSHOT.war 
[INFO] Installing e:\Advance Java\POI\Aegyptologie\pom.xml to C:\Users\prateek\.m2\repository\de\unileipzig\wirote\Aegyptologie\0.1-SNAPSHOT\Aegyptologie-0.1-SNAPSHOT.pom 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD SUCCESS 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 42.299 s 
[INFO] Finished at: 2016-08-19T01:49:13+05:30 
[INFO] Final Memory: 29M/320M 
[INFO] ------------------------------------------------------------------------ 
+0

我正在使用netbeans abs IDE和默認設置:無代理服務器。我測試了連接並且工作正常 –