2013-02-07 16 views
5

私はSTSをダウンロードしてインストールしてから、新しいSpring MVCプロジェクトを作成しました。その直後に私は約22の問題を警告しています。ここにはspring tool suite spring mvc project - 作成直後の問題

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 

どのように問題を解決できますか?ありがとうございます

答えて

10

新しいSTSプロジェクトを初めて作成するときに、多くのエラーが発生しました。これは、私がMavenリポジトリを持っていないか、または以前にMavenを起動/使用していない場合にのみ起こるようです。私の場合は、手動でコマンドラインからMavenコマンドを起動することでこれを解決します。 pom.xmlを含むプロジェクトディレクトリに「cd」し、そこからSTSに付属のmvnを呼び出してください。

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

、オープンSTS、右の「Mavenを」を選択し、プロジェクト名をクリックし、「更新プロジェクト...」「スナップショットの強制アップデート/リリースを」オンを選択します。 「オフライン」は選択しないでください。

+0

大変ありがとうございます!同じ問題を抱えている人にも環境変数を設定することをお勧めします。プロジェクトフォルダを開き、 'mvn compile'を実行するだけです。例えば:http://documentation.magnolia-cms.com/developing/dev-environment/maven/maven-env-var.html – Skeeve

+0

「スナップショット/リリースの強制更新」チェックボックスをオンにすると、それは私のために行われました!ありがとう – nilsi

+0

ありがとう..私の問題を解決.."ArtifactTransferException:org.aspectj:aspectjrt:jarの転送に失敗しました" – tejaspillai

3

プロキシの背後にありますか?その場合は、Mavenを使用するように設定する必要があります。

プロジェクトに右クリックし、Maven-> Update Project Configurationを選択するだけです。これはうまくいくはずです。おそらくあなたはプロジェクトをきれいにする/リフレッシュする必要があります。

+0

クリーン/リフレッシュは、新しい問題を追加しました:見つからないorg.springframework.web.servlet.view.InternalResourceViewResolver 『「説明\tリソース\tパス\t場所\tタイプ クラス』 [設定セット:ContactManager /ウェブコンテキスト] \tサーブレットを-Context.xml \t/ContactManager/src/main/webapp/WEB-INF/spring/appServlet \t行19 \t Spring Beansの問題 ' – Skeeve

+0

私はMaven-> Update Project Configurationを持っていません。オプション。それはあなたが意味することですか? – Skeeve

+0

@OPあなたがそれを見逃した場合 - プロキシはインターネットプロキシを指します。通常、会社のインターネットを使用している場合は、セキュリティのために何らかのプロキシを使用します。 http://maven.apache.org/settings.html#Proxiesを参照して、Mavenプロキシ設定をセットアップしてください。これは、必要なのは、ネット上の中央リポジトリから不足しているアーティファクトを検索できるようにすることです。 – gerrytan

関連する問題