Could not transfer artifact from/to central intellij

Viewed 40400

My Spring boot project using Maven. When i build it using Intellij Community, i get the error

Could not transfer artifact com.jolira:hickory:pom:1.0.0 from/to central (https://repo.maven.apache.org/maven2): Transfer failed for https://repo.maven.apache.org/maven2/com/jolira/hickory/1.0.0/hickory-1.0.0.pom

I can build this project success using cmd command line.

My Intellij Community version is:

IntelliJ IDEA 2020.3.1 (Community Edition) Build #IC-203.6682.168, built on December 29, 2020 Runtime version: 11.0.9.1+11-b1145.63 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. Windows 10 10.0 GC: ParNew, ConcurrentMarkSweep Memory: 1945M Cores: 8

my pom.xml file

<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.3.5.RELEASE</version>
        <relativePath />
    </parent>
    <groupId>com.super.banana</groupId>

    <!-- Always write artifactId with underscore _ -->
    <artifactId>banana_parent</artifactId>
    <version>1.0.0</version>
    <packaging>pom</packaging>
    <name>bananas_parent</name>
    <description>banana Parent</description>
    <modules>
        <module>bananas-mt</module>
        <module>bananas-web</module>
    </modules>
    <properties>
        <java.version>11</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <commons-io.version>2.6</commons-io.version>
        <commons-lang.version>3.10</commons-lang.version>
        <org.mapstruct.version>1.3.1.Final</org.mapstruct.version>
    </properties>
    <dependencies>
    </dependencies>
</project>

How to fix this issue ?

7 Answers

Solution 1: I have fixed this issue, in menu choose File -> Setting -> Build, Execution, Deployment ->Build Tools -> Maven. In section User setting file stick Override and browse to settings.xml of Maven (in my case the settings.xml file in directory ..\apache-maven-3.6.3\conf .

I have proxy configuration in settings.xml) enter image description here

Solution 2:

In my case I have problem with com/jolira/hickory/1.0.0/hickory-1.0.0.pom

Similar your case with another library

I go to repository of hickory on https://mvnrepository.com

enter image description here

I download .jar file and .pom file from maven page

enter image description here

go to {your .m2 directory home}.m2\repository\com\jolira\hickory\1.0.0 and past the hickory-1.0.0.jar and the hickory-1.0.0.pom to there

enter image description here

open command line and run mvn clean install again. It should sucessful

Make sure Java version is set correctly for Maven: File > Settings > Build Execution Deployment > Build Tools > Maven > Importing > JDK for importer:

This error in Intellij usually comes from bundled maven in the IntelliJ. if you want to use the maven inside the ide (either you can use it in the terminal) its better to force the IntelliJ use the installed maven instead of the bundled one. for this you should go to:

menu choose File -> Setting -> Build, Execution, Deployment ->Build Tools -> Maven.

and change the "maven home path:" from "bundled" to the filepath of installed maven in this case for me is the: "C:/Program Files (x86)/apache-maven-3.6.3"

enter image description here

I had this problem too.

You can try

  1. From IntelliJ Idea, File > Invalidate caches... and then restart
  2. Delete your ~/.m2/repositories directory

Then try again.

If that didn't help, it could be related to IDEA-274458 bug. A workaround is to run mvn clean compile which takes care of downloading artifacts from your command line and then "re-import" the project in IDE.

I was getting the "Could not transfer artifact [thing] from/to [repo] Transfer failed" error too, and it turned out that I hadn't added my truststore config into IntelliJ's Maven config.

Settings > Build, Execution, Deployment > Build Tools > Maven > Runner

Under "VM Options" add:

-Djavax.net.ssl.trustStore=/path/to/your/truststore.jks

I was facing the same problem later I got to know that I have selected wrong version of maven, maven 3 was selected in setting-build execution deployment- build tool- maven- maven home path. Then I selected maven 3.8 and my problem resolved.

Make sure you have the correct Java version selected here - For me, it was using the internal Java version and as soon as I selected the correct version(set as JAVA_HOME, it worked) enter image description here

Related