Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved

前端 未结 19 1972
隐瞒了意图╮
隐瞒了意图╮ 2020-11-30 05:09

I have install maven in my machine. I have properly set the class-path and maven home folder. Every time I execute mvn clean install, it gives me exception. I h

相关标签:
19条回答
  • 2020-11-30 05:09

    I faced the same problem but it resolved with some changes in setting.xml(.*\apache-maven-3.3.3\apache-maven-3.3.3\conf).

      <proxies>
      <proxy>
        <id>proxy</id>
        <active>true</active>
        <protocol>http</protocol>
        <host>HOSTNAME</host>
        <port>PORT</port>
      </proxy>
    </proxies>
    

    Just check the hostname and port from the IE setting -> connections -> LAN Setting -> Proxy server

    Hope this will resolve your problem also :)

    0 讨论(0)
  • 2020-11-30 05:11

    I faced the same problem and was frustrated to see as to all options i tried and none of them work,

    Turns out once you have configured everything correctly including settings.xml

    just clear your local repository folder and try mvn commands. That greatly helped me

    Hope this helps others

    0 讨论(0)
  • 2020-11-30 05:14

    For all the Windows users, try moving your codebase to a shorter windows path for eg: C:/myProj

    Deeply nested Maven jar files can create a longer file path in windows. Since windows OS, by default, limits the file path length to 260 characters, it throws exception when trying to read a file located at a path that becomes more than 260 characters.

    You can change this default to increase this limit to more than 260 chracters. Search around the web and you will find many posts on how to do that.

    You can face similar problem while using npm packages also.

    0 讨论(0)
  • 2020-11-30 05:15

    Your debug output indicates that Clean is the first thing that it's trying to run, so I'm guessing it's failing to download any plugins from central.

    First off, see if you can download the plugin jar directly in a web browser: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.jar

    If that works then your web browser has connectivity to central but maven doesn't. That suggests to me that your web browser is using a proxy that maven isn't configured to use.

    Maven proxy settings are described in depth here. To simplify that a little fill this out (replace the protocol/host/port with the values from your internet settings) and put it in the <settings> tag of your maven settings.xml file:

    <proxies>
      <proxy>
        <id>proxy</id>
        <active>true</active>
        <protocol>http</protocol>
        <host>proxy.example.com</host>
        <port>8080</port>
      </proxy>
    </proxies>
    
    0 讨论(0)
  • 2020-11-30 05:15

    In my case my problem was that I was using an older version of NetBeans. The Maven repository removed an http reference, but the embedded Maven in Netbeans had that http reference hard-coded. I was really confused at first because my pom.xml referenced the proper https://repo.maven.apache.org/maven2.

    Fixing it was pretty simple. I downloaded the latest zip archive of Maven from the following location and extracted it to my machine: https://maven.apache.org/download.cgi

    Within Netbeans at Tools -> Options -> Java -> Maven on the "Execution" section I set "Maven Home" to the newly extracted zip file location.

    Now I could build my project....

    0 讨论(0)
  • 2020-11-30 05:19

    The error is due to maven official repository being not accessible. This repo (https://repo.maven.apache.org/maven2/) is not accessible so follow these steps:

    1. Firstly delete your /home/user/.m2 folder
    2. create .m2 folder at user home and repository folder within .m2
    3. copy the default settings.xml to .m2 folder
    4. Change mirrors as follows in the settings.xml as shown in below snap mirror_settings

    <mirrors>
      <mirror>
        <id>UK</id>
        <name>UK Central</name>
        <url>http://uk.maven.org/maven2</url>
        <mirrorOf>central</mirrorOf>
      </mirror>
    </mirrors>

    1. Execute the mvn clean commands now .....
    0 讨论(0)
提交回复
热议问题