After installing maven under windows, run: mvn help:system error

  In fact, after Maven is installed, executing the mvn help:system command reports an error, and before this error is resolved, when using Eclipse to build a Maven project, it also reports Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp error, As follows:

        Of course, in the meantime, when using the maven command to create a maven project, there are the following prompts:

Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom
"[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-clean-plugin:2.5:Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5"

        I saw some reasons for analysis from the Internet, and they are summarized as follows:

  1) The network used cannot access maven.apache.org

  2) The proxy server is not configured, or the configuration is incorrect

  If your company, for security reasons, requires you to access the Internet using a security-authenticated proxy, then you need to configure an HTTP proxy for Maven.

  Modify the settings.xml files under D:\Maven and D:\software\maven\apache-maven-3.5.3\conf (specially note that the settings.xml in both places need to be modified), and add the proxy configuration as follows:


  in:

        active: means to activate the agent;

        protocol: indicates the protocol of the proxy, here is http;

        username: proxy server username;

        password: proxy server password;

        host: proxy server address;

        port: proxy server port;

        nonProxyHosts: Host addresses that are not accessed by proxy servers.

       After the modification, the mvn help:system command is executed normally in the cmd window, and the error Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp is not reported when creating a Maven project in Eclipse, and the project is created normally.

        3) Add new Catalog configuration in Eclipse Maven configuration

        Configuration: http://repo1.maven.org/maven2/archetype-catalog.xml , you can also download it locally, and then add it, which is faster, and eclipse networking is slower, as shown below:


  Next, create a web project using the catalog you just added.


  At this time, you can see the Eclipse online download:


  This time to see if the creation is successful.

  If it still cannot be created or the problem is not resolved, you can install the following methods:

  a. Delete the file path that maven has downloaded: .m2\repository\org\apache\maven, in my case it is D:\Maven\repo\org\apache\maven. After deleting it, try again. If you see progress at this time, just wait patiently.

  b. Maven is slow to download jar and can use domestic Ali mirror

        The specific configuration file (settings.xml) is as follows, placed in the .m2 folder, and .m2 is generally located in the user directory. Of course, I need to modify D:\Maven\settings.xml and D:\software\maven\apache-maven-3.5.3\conf\settings.xml here.

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"  
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
         xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0  
            http://maven.apache.org/xsd/settings-1.0.0.xsd">  
      
    <!-- This is to configure Ali Maven mirror -->  
    <mirrors>  
        <mirror>  
          <id>aliyun</id>  
          <name>aliyun</name>  
          <url>http://maven.aliyun.com/nexus/content/groups/public/</url>  
          <mirrorOf>central</mirrorOf>  
        </mirror>  
    </mirrors>  
      
    <profiles>  
        <profile>  
            <id>nexus</id>  
            <repositories>  
                <repository>  
                    <id>central</id>  
                    <url>http://repo.maven.apache.org/maven2</url>  
                    <snapshots>  
                        <enabled>false</enabled>  
                    </snapshots>  
                </repository>  
                <repository>  
                    <id>ansj-repo</id>  
                    <name>ansj Repository</name>  
                    <url>http://maven.nlpcn.org/</url>  
                    <snapshots>  
                        <enabled>false</enabled>  
                    </snapshots>  
                </repository>  
            </repositories>  
        </profile>  
    </profiles>  
  
    <activeProfiles>  
        <activeProfile>nexus</activeProfile>  
    </activeProfiles>  
</settings>

 

 

Reference article: http://love2157dream.iteye.com/blog/2100337

http://blog.csdn.net/yudilan6/article/details/51996673

https://www.cnblogs.com/rever/p/7076596.html

http://blog.csdn.net/afgasdg/article/details/12757433

http://blog.csdn.net/nphyez/article/details/34438927

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326195901&siteId=291194637