Maven environment configuration steps on the pit

        Tonight, when I followed the video to learn spring, I created a maven project, and it kept prompting that the Sync download was abnormal. After working all night, I finally got the environment. Here's a summary of tonight.

        1. Make sure that maven is installed and the environment variables are configured.

          After downloading and installing maven, you also need to configure maven environment variables on your computer. For this part, refer to the online tutorial. Use the command mvnn -v to verify that maven is configured.

        Remarks: Although the maven environment variable is installed and configured on my computer, I found that after using mvn -v, I was prompted that the mvn command could not be found. It means that the maven environment variable is not configured properly.

        2. Idea tool configuration mave

        3. Configure the jdk version used by the project

        Since the video tutorial uses jdk17, I also configured the version of jdk17.

 

        4. Configure the settings.xml file of maven, and mainly modify three places, namely the local warehouse address, Alibaba Cloud image and jdk version.

        Local maven warehouse address:

<localRepository>/Users/liuqinhou/Desktop/Other/Maven/MavenRepo</localRepository>

        Alibaba Cloud mirror address: Note that this is a new version of the address, and the old version of the address cannot be used. Reference  Warehouse Services

<mirror>
    <id>AliRepo-aliyun</id>
    <mirrorOf>*</mirrorOf>
    <name>Mirror Name for the Alirepo.</name>
    <url>https://maven.aliyun.com/repository/public</url>
</mirror>

         jdk version:

<profile>
      <id>jdk-17</id>
      <activation>
        <activeByDefault>true</activeByDefault>
        <jdk>17</jdk>
      </activation>
      <properties>       
        <maven.compiler.source>17</maven.compiler.source>       
        <maven.compiler.target>17</maven.compiler.target>       
        <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>       
      </properties>   
</profile>

After completing the above configuration, my maven project finally Sync passed

 

 

Guess you like

Origin blog.csdn.net/liuqinhou/article/details/131525105