2013-02-07 7 views
5

Więc, pobrałem i zainstalowałem STS, a następnie utworzyłem nowy Spring MVC Project. Zaraz po tym sts ostrzec mi około 22 problemów, oto one:Spring Tool Suite Spring Projekt MVC - 22 problemy zaraz po stworzeniu

Description Resource Path Location Type 
Missing artifact aopalliance:aopalliance:jar:1.0 pom.xml /ContactManager line 1   Maven Dependency Problem 
Missing artifact org.springframework:spring-beans:jar:3.1.1.RELEASE pom.xml /ContactManager line 1 Maven Dependency Problem 
Missing artifact org.springframework:spring-context:jar:3.1.1.RELEASE pom.xml /ContactManager line 1 Maven Dependency Problem 
Missing artifact org.springframework:spring-aop:jar:3.1.1.RELEASE pom.xml /ContactManager line 1 Maven Dependency Problem 
ArtifactDescriptorException: Failed to read artifact descriptor for org.slf4j:slf4j-api:jar:1.6.6: ArtifactResolutionException: Failure to transfer org.slf4j:slf4j-api:pom:1.6.6 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 org.slf4j:slf4j-api:pom:1.6.6 from/to central (http://repo.maven.apache.org/maven2): C:\Users\Skeeve\.m2\repository\org\slf4j\slf4j-api\1.6.6\slf4j-api-1.6.6.pom.ahc3656264e3b414ddf (Не удается найти указанный файл) pom.xml /ContactManager line 1 Maven Dependency Problem 
Missing artifact org.slf4j:jcl-over-slf4j:jar:1.6.6 pom.xml /ContactManager line 1 Maven Dependency Problem 
Missing artifact org.aspectj:aspectjrt:jar:1.6.10 pom.xml /ContactManager line 1 Maven Dependency Problem 
Missing artifact org.springframework:spring-web:jar:3.1.1.RELEASE pom.xml /ContactManager line 1 Maven Dependency Problem 
Missing artifact org.springframework:spring-context-support:jar:3.1.1.RELEASE pom.xml /ContactManager line 1 Maven Dependency Problem 
Missing artifact org.springframework:spring-webmvc:jar:3.1.1.RELEASE pom.xml /ContactManager line 1 Maven Dependency Problem 
Missing artifact org.springframework:spring-asm:jar:3.1.1.RELEASE pom.xml /ContactManager line 1 Maven Dependency Problem 
Missing artifact org.springframework:spring-expression:jar:3.1.1.RELEASE pom.xml /ContactManager line 1 Maven Dependency Problem 
Missing artifact org.springframework:spring-core:jar:3.1.1.RELEASE pom.xml /ContactManager line 1 Maven Dependency Problem 
Missing artifact junit:junit:jar:4.7 pom.xml /ContactManager line 1 Maven Dependency Problem 
Missing artifact javax.servlet:jstl:jar:1.2 pom.xml /ContactManager line 1 Maven Dependency Problem 
Missing artifact javax.servlet.jsp:jsp-api:jar:2.1 pom.xml /ContactManager line 1 Maven Dependency Problem 
Missing artifact javax.servlet:servlet-api:jar:2.5 pom.xml /ContactManager line 1 Maven Dependency Problem 
Missing artifact javax.inject:javax.inject:jar:1 pom.xml /ContactManager line 1 Maven Dependency Problem 
Missing artifact log4j:log4j:jar:1.2.15 pom.xml /ContactManager line 1 Maven Dependency Problem 
Missing artifact org.slf4j:slf4j-log4j12:jar:1.6.6 pom.xml /ContactManager line 1 Maven Dependency Problem 

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

Description Resource Path Location Type 
The container 'Maven Dependencies' references non existing library 'C:\Users\Skeeve\.m2\repository\org\springframework\spring-context\3.1.1.RELEASE\spring-context-3.1.1.RELEASE.jar' ContactManager  Build path Build Path Problem 

Jak mogę rozwiązać ten problem? Dziękujemy

Odpowiedz

10

Podczas tworzenia nowego projektu STS po raz pierwszy napotkałem wiele błędów. Wydaje się, że dzieje się tak tylko wtedy, gdy nie mam żadnego repozytorium Maven lub wcześniej nie uruchomiłem/nie użyłem Mavena. W moim przypadku rozwiązuję to przez ręczne uruchamianie polecenia Maven z wiersza poleceń. Spróbuj "cd" do katalogu projektu zawierającego pom.xml i zadzwoń pod numer mvn, który pochodzi z STS.

cd c:\users\name\sts-projects\projectname 
    c:\programs\springsource\apache-maven-3.0.3\bin\mvn compile 

Następnie otwórz STS, kliknij prawym przyciskiem myszy na nazwę projektu, wybrać 'Maven', 'Aktualizacja projektu ...' Select na 'Siła Aktualizacja zdjęć/Uwolnienia'. Nie wybieraj opcji "Offline".

+0

Działa idealnie dla mnie, dziękuję bardzo! Polecam również każdemu, kto napotka ten sam problem, aby ustawić zmienne środowiskowe, aby mogli po prostu otworzyć folder projektu i uruchomić "kompilację mvn" .Tutaj jest link, na przykład: http://documentation.magnolia-cms.com/developing/dev-environment/maven/maven-env-var.html – Skeeve

+0

Zaznaczenie pola "Wymuś aktualizację migawek/wersji" zrobiło to za mnie! Dzięki – nilsi

+0

dziękuję .. rozwiązać mój problem .."Wyjątek ArtifactTransferException: niepowodzenie przeniesienia org.aspectj: aspectjrt: jar" – tejaspillai

3

Czy jesteś za proxy? Jeśli tak, musisz skonfigurować Mavena, aby z niego korzystać.

Jeśli tak nie jest, wystarczy kliknąć prawym przyciskiem myszy projekt i wybrać opcję Maven-> Zaktualizuj konfigurację projektu. To powinno działać. Prawdopodobnie musisz wyczyścić/odświeżyć projekt.

+0

czyste/odświeżania dodał nowy problem: „Opis \t zasobów \t Ścieżka \t Lokalizacja \t Rodzaj Klasa 'org.springframework.web.servlet.view.InternalResourceViewResolver' Nie znaleziono [set config: ContactManager/web-context] \t servlet -context.xml \t/ContactManager/src/main/webapp/WEB-INF/spring/appServlet \t wiersz 19 \t Problem fasoli sprężynowej " – Skeeve

+0

Nie mam Maven-> Aktualizuj konfigurację projektu, Mam Maven-> Aktualizuj projekt .. . opcja. Czy to masz na myśli? – Skeeve

+0

@OP na wypadek, gdybyś go przegapił - proxy oznacza internetowy serwer proxy. Zwykle, jeśli korzystasz z firmowego Internetu, będziesz mieć jakiś proxy do celów bezpieczeństwa. Zajrzyj na http://maven.apache.org/settings.html#Proxies, aby skonfigurować swoją konfigurację serwera proxy. Jest to konieczne, aby mógł wyszukać brakujący artefakt z centralnego repozytorium w sieci – gerrytan