Home > OS >  Intellij 2021.3: Maven not able to resolve dependencies after update to intellij 2021.3
Intellij 2021.3: Maven not able to resolve dependencies after update to intellij 2021.3

Time:12-05

Things worked fine in 2021.2 but when same project opened in 2021.3 then stated to got following error

http://0.0.0.0/ during a previous attempt. This failure was cached in the local repository and resolution will not be reattempted until the update interval of maven-default-http-blocker has elapsed or updates are forced. Original error: Could not transfer metadata com.domain.sub-domain.project:private-commons:1.0.0-SNAPSHOT/maven-metadata.xml from/to maven-default-http-blocker (http://0.0.0.0/): transfer failed for http://0.0.0.0/com/domain/sub-domain/project/private-repo/1.0.0-SNAPSHOT/maven-metadata.xml
Cannot resolve junit:junit:4.12
Cannot resolve org.apache.camel:camel-test:2.23.0
Cannot resolve com.amazonaws:aws-java-sdk-glacier:1.11.415

enter image description here

CodePudding user response:

2021.3 IDE version has updated the version of the bundled Maven to 3.8.1. In this version, Maven blocks the access to http repositories by default. Before that, Maven itself has moved from using the http repositories.

So now one needs to explicitly configure Maven to allow http repositories if they are used in the project. E.g. in settings.xml add a mirror to your http repository that allows http:

<mirrors>
        <mirror>
            <id>my-repo-mirror</id>
            <name>My Repo HTTP Mirror</name>
            <url>http://url-to.my/repo</url>
            <mirrorOf>my-repo</mirrorOf>
            <blocked>false</blocked>
        </mirror>
</mirrors>

You can also check the related discussion at https://stackoverflow.com/a/67002852/2000323 for ways to configure it.

Another option is to specify older Maven version in IDE: Settings (Preferences on macOS) | Build, Execution, Deployment | Build Tools | Maven | Maven home path.

  • Related