简体   繁体   中英

mvn install error again

mvn install i get the following error

[ERROR] Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its
 dependencies could not be resolved: Failed to read artifact descriptor for org.
apache.maven.plugins:maven-resources-plugin:jar:2.5: Could not transfer artifact
 org.apache.maven.plugins:maven-resources-plugin:pom:2.5 from/to central (http:/
/repo.maven.apache.org/maven2): Connection to http://repo.maven.apache.org refus
ed: Connection timed out: 

I tried to set proxy using the earlier answers in stack but still i am facing the problem. A clear step thru help is required.

Solution:

Add the below dependency to pom.xml:

<dependency>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-resources-plugin</artifactId>
    <version>2.5</version>
</dependency>

Then run "mvn clean install" from command prompt.

After that refresh (F5) and upgrade the project configuration in eclipse (run > Maven > Update Project Configuration.)

Faced the same problem. This happens because of cached files. What worked for me was deleting the contents of repository folder. It did download all the files again at the next build but solved the problem.

Add a global settings.xml(sample will be available inside your mvn.home/conf/settings.xml) in your .m2 folder, that resides inside the c:/user/username/.m2 .. Add the following entry in the settings.xml within

  <pluginRepositories>

                                    <pluginRepository>
                                            <id>central</id>
                                            <name>Maven Plugin Repository</name>
                                            <url>http://repo1.maven.org/maven2</url>
                                            <releases>
                                                    <enabled>false</enabled>
                                            </releases>
                                            <snapshots>
                                                    <enabled>false</enabled>
                                            </snapshots>
                                    </pluginRepository>

                            </pluginRepositories>

This would solve the above issue.

I had the same problem caused by proxy Setting. I solved it adding my proxy setting in the setting.xml file located under the maven installation directory in /conf/settings.xml

<proxies>
    <proxy>
        <id>optional</id>
        <active>true</active>
        <protocol>http</protocol>
        <username>xxxx</username>
        <password>xxxxx</password>
        <host>xxxxxxx</host>
        <port>xxxx</port>
        <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
    </proxy>
</proxies>

I solved this problem by including the following lines in my

settings.xml

file which can be found at C:\\Program Files\\Apache\\maven\\apache-maven-3.3.9\\conf

<proxies>
<proxy>
  <id>optional</id>
  <active>true</active>
  <protocol>https</protocol>
  <host>xxxxxxxxxx</host>
  <port>xxxx</port>
  <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>

Please pay attention to protocol- "https" not "http". Save this file and update user settings of your IDE by navigating to

Windows->Preferences->Maven->User Settings->User Settings to

C:\Program Files\Apache\maven\apache-maven-3.3.9\conf\settings.xml

Hope this helps.

In eclipse go to Window-->Preferences-->Maven--> Unselect options "Do not automatically update dependencies from remote repositories"

Doing so has done the trick for me. I was then able to download all dependencies.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM