I want to build a spring mvc project by maven,I got the following error:
The following artifacts could not be resolved: org.aopalliance:com.springsource.org.aopalliance:jar:1.0.0, org.hibernate:hibernate-validator:jar:4.2.0.Beta1: Could not find artifact org.aopalliance:com.springsource.org.aopalliance:jar:1.0.0 in central (http://repo1.maven.org/maven2)
I use eclipse and m2eclipse plugin. I don't know how to add local repository. And I found for different versions of eclipse,the result is different. Some can pass, some fail.I am confused.
By the way where can I find the version of maven used in m2eclipse?
Thanks in advanced.
Update:Now I can handle hibernate-validator,but even I deleted all spring mvc dependencies,I found there are many other library are dependent on com.springsource.org.aopalliance,
Since you are working with spring artifacts, you can refer to this doc. If you are working on released versions of spring, you can add the following repository in your settings.xml
<repository>
<id>com.springsource.repository.maven.release</id>
<url>http://maven.springframework.org/release/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
[Edit 1: based on the comment]
The groupId/projectId of aopalliance seems to indicate it is in spring enterprise bundle repository. The contents of this accessible from the following repository url.
<url>http://repository.springsource.com/maven/bundles/release/</url>
As for hibernate-validator, being a beta release, it is possibly not available in the normal repos. It is available from
<url>http://repository.jboss.org/nexus/content/groups/public-jboss/</url>
Check your %.m2\repository\org\aopalliance\com.springsource.org.aopalliance\1.0.0\
.
If there isn't a com.springsource.org.aopalliance-1.0.0.jar
in there, just download it by yourself and copy it to this folder.
The version of maven used in m2eclipse can be found in Window->Preferences->Maven->Installations
It looks like the artifact cann't be found in any repository you have defined in your settings.xml or pom file. Try adding sonatype repositories, they have artifacts you're looking for
In your pom.xml , add :
<project>
...
<repositories>
<repository>
<id>sonatype repo</id>
<url>https://repository.sonatype.org/content/repositories/central</url>
</repository>
</repositories>
...
</project>
However it's good practice to have its own repository manager (nexus, archiva, ...)
You should add the "external" repository to your pom.xml:
<repository>
<id>com.springsource.repository.bundles.external</id>
<url>http://repository.springsource.com/maven/bundles/external</url>
</repository>
My complete repositories tag in pom.xml is as follows:
<repositories>
<repository>
<id>com.springsource.repository.maven.release</id>
<url>http://repo.springsource.org/release/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>com.springsource.repository.bundles.release</id>
<url>http://repository.springsource.com/maven/bundles/release</url>
</repository>
<repository>
<id>com.springsource.repository.bundles.external</id>
<url>http://repository.springsource.com/maven/bundles/external</url>
</repository>
</repositories>