javaspring-bootmavenartifact

Could not transfer artifact from/to central IntelliJ


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 do I fix this issue?


Solution

  • 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 .

    enter image description here

    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 paste 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

    Solution 3

    Go to your Maven directory in local machine computer. Inside directory ..\apache-maven-(version)\conf (in my case E:\soft\apache-maven-3.8.4\conf), open settings.xml and add proxy configuration to this file. Back to your project directory, open command line cmd and run mvn clean install. Back to IntelliJ and reload.

    enter image description here

    Solution 4

    In IntelliJ, choose File->Setting, search Proxy. Choose Proxy tab and enter proxy information from there.

    enter image description here

    enter image description here

    Enter proxy information, press Apply button and press OK Click on Maven panel on the right side of IntelliJ and choose icon reload

    enter image description here

    enter image description here