5

I am facing issue with downloading dependency jars through maven install.

From eclipse console, i can say maven is trying to download jars from old central repository url:"https://repo.maven.apache.org/maven2" instead of "http://repo1.maven.org/maven2/"

My 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>com.xxxx</groupId>
  <artifactId>TestServices</artifactId>
  <version>7.0.3.6</version>
  <dependencies>
    <dependency>
        <groupId>javax.activation</groupId>
        <artifactId>activation</artifactId>
        <version>1.0.2</version>
        <scope>compile</scope>
    </dependency>
  </dependencies>

And my build is failing with the following error message:

[ERROR] Failed to execute goal on project 'xxxyyy': Could not resolve dependencies for project xxxyyy:jar:4.0.3.6: The following artifacts could not be resolved: org.codehaus:xstream:jar:1.3.1, gxs:ai:jar:0.5, javax.activation:activation:jar:1.0.2, com.oracle.jdbc:classes12:jar:9.2.0.5, org.eclipse.core:resources:jar:3.1.0, org.eclipse.core:runtime:jar:3.2.0.v20060603, org.eclipse.emf:common:jar:2.2.1.v200609210005, org.eclipse.emf:ecore:jar:2.2.1.v200609210005, org.eclipse.emf:ecore.xmi:jar:2.2.1.v200609210005, org.eclipse.equinox:common:jar:3.2.0.v20060603, org.eclipse:osgi:jar:3.2.1.R32x_v20060919, org.eclipse.wst.xml:core:jar:1.1.1.v200609210600, org.eclipse:xsd:jar:2.2.1.v200609210005, javax.mail:mail:jar:1.3.2, org.apache:log4j:jar:1.2.8: Failure to find org.codehaus:xstream:jar:1.3.1 in ${localRepo} was cached in the local repository, resolution will not be reattempted until the update interval of 'abcd' has elapsed or updates are forced -> [Help 1]
Sumanth
  • 595
  • 3
  • 14
  • 39

2 Answers2

4

Try to add this

 <repositories>
    <repository>
        <id>central</id>
        <url>https://repo1.maven.org/maven2/</url>
      </repository>
  </repositories>

And check this documentation of Maven Repositories

And following the Documentation:

Repositories

The repository is one of the most powerful features of the Maven community. The default central Maven repository lives on https://repo.maven.apache.org/maven2/. Another source for artifacts not yet in iBiblio is the Codehaus snapshots repo.

Maven Repositories Default Doc

Gatusko
  • 2,503
  • 1
  • 17
  • 25
  • No.... this comes already [from the Super POM](http://maven.apache.org/ref/3.3.9/maven-model-builder/super-pom.html)... – Tunaki Jan 12 '17 at 19:24
  • My bad the SEcond link of Doc was bad. Alrteady edited the link. I quoted from the documentation of Maven Repositories. But you are right – Gatusko Jan 12 '17 at 19:27
  • 1
    @Gatusko Now repo1.maven.org and repo.maven.apache.org need https: https://links.sonatype.com/central/501-https-required – artscan Jan 20 '20 at 13:03
  • Thanks @artscan I've already edited my answer. – Gatusko Jan 20 '20 at 13:12
0

After you have changed the repository address:

 <repositories>
<repository>
    <id>central</id>
    <url>http://repo1.maven.org/maven2/</url>
  </repository>

You have to clean every previously cached data in your repository, neither manually or by running maven phases (e.g package) with -U option package -U

-U means force update of all dependencies.

Mr.Q
  • 4,316
  • 3
  • 43
  • 40