2013-05-13 2 views
0

저는 봄에 익숙하지 않습니다. 봄에 Helloworld 어플리케이션을 처음으로 개발할 것입니다. 나는스프링 종속성 해상도

봄 2.5.6

JDK 1.7

이클립스 3.6

메이븐

내가 스프링 프레임 워크를 다운로드하고 필요한 모든 추가 사용 무엇 항아리에 내 내 pom.xml 파일에 종속성을 추가하고 나에게 다음과 같은 오류를 제공 프로젝트를 빌드 할 때 프로젝트하지만

Could not resolve dependencies for Project.... 

내 pom.xml 파일은

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 
<modelVersion>4.0.0</modelVersion> 

<groupId>de.tum.ibis.wsc</groupId> 
<artifactId>SpringHelloWorld</artifactId> 

<packaging>war</packaging> 
<version>0.0.1-SNAPSHOT</version> 
<name>Web Services Computing</name> 
<url>http://dss.in.tum.de</url> 

<properties> 
    <output.filename>hello</output.filename> 
</properties> 

<!-- //////////////////////////////////////////////////////////// --> 
<!-- //////////////////////////////////////////////////////////// --> 
<!-- /////////// DEPENDENCIES --> 

<dependencies> 

<!-- Spring framework --> 
    <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring</artifactId> 
     <version>2.5.6</version> 
    </dependency> 

    <!-- Spring MVC framework --> 
    <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring-webmvc</artifactId> 
     <version>2.5.6</version> 
    </dependency> 

    <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring-webmvc</artifactId> 
     <version>2.5.6</version> 
    </dependency> 

    <!-- JUnit to run the tests --> 
    <dependency> 
     <groupId>junit</groupId> 
     <artifactId>junit</artifactId> 
     <version>4.10</version> 
     <scope>test</scope> 
    </dependency> 

    <!-- Java servlet API --> 
    <dependency> 
     <groupId>javax.servlet</groupId> 
     <artifactId>servlet-api</artifactId> 
     <version>2.5</version> 
    </dependency> 

    <!-- Velocity templating engine --> 
    <dependency> 
     <groupId>org.apache.velocity</groupId> 
     <artifactId>velocity</artifactId> 
     <version>1.7</version> 
    </dependency> 

    <!-- JSTL --> 
    <dependency> 
     <groupId>javax.servlet</groupId> 
     <artifactId>jstl</artifactId> 
     <version>1.2</version> 
    </dependency> 

    <!-- langCommons --> 
    <dependency> 
     <groupId>org.apache.commons</groupId> 
     <artifactId>commons-lang3</artifactId> 
     <version>3.0.1</version> 
    </dependency> 

</dependencies> 

<pluginRepositories> 
    <pluginRepository> 
     <id>codehaus-snapshots</id> 
     <name>Codehaus Snapshots</name> 
     <url>http://nexus.codehaus.org/snapshots/</url> 
     <releases> 
      <enabled>false</enabled> 
     </releases> 
     <snapshots> 
      <enabled>true</enabled> 
     </snapshots> 
    </pluginRepository> 
</pluginRepositories> 

<repositories> 
    <repository> 
     <id>codehaus-snapshots</id> 
     <name>Codehaus Snapshots</name> 
     <url>http://nexus.codehaus.org/snapshots/</url> 
     <releases> 
      <enabled>false</enabled> 
     </releases> 
     <snapshots> 
      <enabled>true</enabled> 
     </snapshots> 
    </repository> 
</repositories> 


<!-- build configuration --> 
<build> 
    <finalName>${output.filename}</finalName> 

    <plugins> 
     <!-- CARGO plugin to start an embedded Jetty for testing --> 
     <plugin> 
      <groupId>org.codehaus.cargo</groupId> 
      <artifactId>cargo-maven2-plugin</artifactId> 
      <version>1.2.4</version> 

      <configuration> 
       <container> 
        <containerId>jetty7x</containerId> 
        <type>embedded</type> 
       </container> 
      </configuration> 
     </plugin> 
    </plugins> 
</build> 

메이븐 출력입니다 :

[INFO] ------------------------------------------------------------------------ 
Downloading:  http://repo.maven.apache.org/maven2/org/springframework/spring/2.5.6/spring-2.5.6.pom 
Downloading: http://repo.maven.apache.org/maven2/org/springframework/spring- webmvc/2.5.6/spring-webmvc-2.5.6.pom 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 21.301s 
[INFO] Finished at: Mon May 13 14:42:03 CEST 2013 
[INFO] Final Memory: 3M/15M 
[INFO] ------------------------------------------------------------------------ 
[WARNING] The requested profile "local" could not be activated because it does not exist. 
[ERROR] Failed to execute goal on project SpringHelloWorld: Could not resolve dependencies for project de.tum.ibis.wsc:SpringHelloWorld:war:0.0.1-SNAPSHOT: Failed to collect dependencies for [org.springframework:spring:jar:2.5.6 (compile), org.springframework:spring-webmvc:jar:2.5.6 (compile), junit:junit:jar:4.10 (test), javax.servlet:servlet-api:jar:2.5 (compile), org.apache.velocity:velocity:jar:1.7 (compile), javax.servlet:jstl:jar:1.2 (compile), org.apache.commons:commons-lang3:jar:3.0.1 (compile)]: Failed to read artifact descriptor for org.springframework:spring:jar:2.5.6: Could not transfer artifact org.springframework:spring:pom:2.5.6 from/to central (http://repo.maven.apache.org/maven2): connection timed out to http://repo.maven.apache.org/maven2/org/springframework/spring/2.5.6/spring-2.5.6.pom -> [Help 1] 

    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. 
    [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 read the following articles: 
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException 

이 오류가 발생하는 이유는 무엇입니까? 사전

+0

maven 출력은 어떤 종속성이 없는지 알려줍니까? 100 % 그들은 당신이 사용하는 repos에 있는지 확신합니까? maven 출력을 조금 더 게시 할 수 있습니까? –

+0

@leo 내 업데이트를 확인하십시오 – Wearybands

+0

어떻게 Maven을 실행합니까? 프록시를 받고 있습니까? – acdcjunior

답변

0

에서

덕분에 MVN 출력 받는다는에 따르면 "http://repo.maven.apache.org/maven2/org/springframework/spring/2.5.6/spring-2.5.6.pom"를 가져올 수 없습니다.

하지만 지금은 내 브라우저에서 가져올 수 있습니다. 이와 같은 문제는 네트워킹/프록시 문제로 인해 발생할 수 있습니다.

당신의 maven/proxying/dns 설정에 까다로운 점이 없다면, 대체 repo를 사용하여 dep를 해결하려고 노력했습니다. 당신은 trougmes를 가지고 있습니다. 예 : https://repository.jboss.org/nexus/index.html#welcome

대체 리포지토리를 사용하려면이 방법이 유용 할 수 있습니다. 다음은 내 프로젝트 중 하나의 저장소 섹션의 복사하여 붙여 넣기입니다.

<repositories> 

    <repository> 
     <snapshots> 
      <enabled>false</enabled> 
     </snapshots> 
     <id>JBossCommunity_Releases</id> 
     <name>Releases Repository Group</name> 
     <url>https://repository.jboss.org/nexus/content/repositories/releases</url> 
    </repository> 

    <repository> 
     <snapshots> 
      <enabled>false</enabled> 
     </snapshots> 
     <id>JBossCommunity_Public</id> 
     <name>Public Repository Group</name> 
     <url>https://repository.jboss.org/nexus/content/repositories/public</url> 
    </repository> 

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

    <repository> 
     <id>spring-maven-milestone</id> 
     <name>Spring Maven Milestone Repository</name> 
     <url>http://maven.springframework.org/milestone</url> 
    </repository> 

</repositories> 
+0

대체 Repos가 무엇을 의미합니까? – Wearybands

+0

아티팩트 (이 경우 종속성 병)는 메이븐 저장소에서옵니다. 불이행을 제외하고는, "중앙"레포에는 다양한 당사자들이 유지 보수를 제공합니다. 그게 내가 "대체 레포지 (alternative repos)"의 의미였던 것. 우리는 심지어 우리 가정의 양조장을 한 번 호스팅했던 자체의 내부의 repo를 가지고 있었다, 아무것도 공상하지 마라. ... –

+0

... pom.xml에 따르면 이미 codehouse repo를 사용하고 있습니다. 나는 spring과 jboss 커뮤니티에 의해 유지되는 repos를 사용하는 우리의 작업 프로젝트에서 복사 - 붙여 넣기를 게시했다. 빌드가 스프링 관련 아티팩트를 해결하지 못하기 때문에 메이븐이 스프링 녀석 자신이 관리하는 레포에서 가져올 수있는 좋은 기회가 있습니다. –