Maven build error

I want to create a mvc spring maven project, 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 the eclipse plugin and m2eclipse. I do not know how to add a local repository. And I found for different versions of eclipse, the result is different. Some may pass, some fail. I'm confused.

By the way, where can I find the maven version used in m2eclipse?

Thanks for the advanced.

Update: I can now handle the hibernate-validator, but even I removed all the spring mvc dependencies, I found that many other libraries depend on com.springsource.org.aopalliance, enter image description here

+3
source share
4 answers

spring, . spring, settings.xml

   <repository>
      <id>com.springsource.repository.maven.release</id>
      <url>http://maven.springframework.org/release/</url>
      <snapshots>
          <enabled>false</enabled>
       </snapshots>
   </repository>

[ 1: ]

groupId/projectId aopalliance, -, , spring . URL- .

<url>http://repository.springsource.com/maven/bundles/release/</url>

hibernate-validator, -, , .

<url>http://repository.jboss.org/nexus/content/groups/public-jboss/</url>
+1

%.m2\repository\org\aopalliance\com.springsource.org.aopalliance\1.0.0\. com.springsource.org.aopalliance-1.0.0.jar, .

+2

maven, m2eclipse, Window- > Preferences- > Maven- > Installations

It seems that the artifact cannot be found in any repository that you defined in the settings.xml or pom file. Try adding sonatip repositories , they have the artifacts you are 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, good practice is to have your own repository manager (nexus, archiva, ...)

+1
source

You should add an "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 full repository 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>
+1
source

Source: https://habr.com/ru/post/1796748/


All Articles