Installation and configuration of Maven in IDEA (detailed tutorial)

1. Download IntelliJ IDEA software

  • Just download the Community Edition
  • Here is no introduction to download and install Idea

2. Construction of Java environment

  • Install JDK
  • Configure environment variables (no introduction)

3. Maven download and decompression

  • Download the Maven installation package URL from the official website: http://maven.apache.org/download.cgi
  • Download and unzip to any folder

4. Configuration of Maven environment variables

  1. Open the configuration of environment variables

  2. Open the system variables, create a new system variable M2_HOME, click the browse directory below, the variable value is the path of the maven installation package you have unzipped, the example here is E:\Maven\apache-maven-3.6.0
    System variable

  3. Then find the Path system variable, click New, add the bin directory under the maven installation package, the purpose is to let the computer recognize maven-related instructions

maven environment variable settings

4. Open the cmd input mvn -version, test whether the maven environment variable is configured successfully, if the following message appears, it has been configured successfully
Insert picture description here
5. At this point, the maven environment variable has been configured successfully, go to the next step

5. Configure settings.xml

  • Enter the maven installation package directory -> enter the conf folder

  • Open the configuration file settings.xml. The purpose of this step is to find the required package according to your configuration path when the project needs to be dependent on the package later.

  • Step 1: Configure the local maven dependency package repository:

    • Uncomment the localRepository and set the value to your local dependency repository
    • If there is no dependency package locally, it is best to configure as a remote warehouse, this step can be omitted
      <localRepository>E:\Maven\repository</localRepository>
    
         
          
          
    • 1

    My local warehouse:
    Insert picture description here

  • Next, configure the remote dependency package repository, here 阿里云is an example

<mirrors>
    <mirror>
        <id>nextus-aliyun</id>
        <mirrorOf>*</mirrorOf>
        <name>Nexus aliyun</name>
        <url>http://maven.aliyun.com/nexus/content/groups/public</url>
    </mirror>
</mirrors>

   
    
    

Insert picture description here
Just click save after modification

6. Open Idea and configure the relevant parameters of maven

  • Click file-click settings-search for maven, start to configure options After
    Insert picture description here
    configuration is complete, click apply to complete!

7. Create a maven project and test the guide package


Guide package example
There is no problem when trying to import hive and hdfs , indicating success.
At the same time, you can view more information about the package on the right side of the project.
Insert picture description here

1. Download IntelliJ IDEA software

  • Just download the Community Edition
  • Here is no introduction to download and install Idea

2. Construction of Java environment

  • Install JDK
  • Configure environment variables (no introduction)

3. Maven download and decompression

  • Download the Maven installation package URL from the official website: http://maven.apache.org/download.cgi
  • Download and unzip to any folder

4. Configuration of Maven environment variables

  1. Open the configuration of environment variables

  2. Open the system variables, create a new system variable M2_HOME, click the browse directory below, the variable value is the path of the maven installation package you have unzipped, the example here is E:\Maven\apache-maven-3.6.0
    System variable

  3. Then find the Path system variable, click New, add the bin directory under the maven installation package, the purpose is to let the computer recognize maven-related instructions

maven environment variable settings

4. Open the cmd input mvn -version, test whether the maven environment variable is configured successfully, if the following message appears, it has been configured successfully
Insert picture description here
5. At this point, the maven environment variable has been configured successfully, go to the next step

5. Configure settings.xml

  • Enter the maven installation package directory -> enter the conf folder

  • Open the configuration file settings.xml. The purpose of this step is to find the required package according to your configuration path when the project needs to be dependent on the package later.

  • Step 1: Configure the local maven dependency package repository:

    • Uncomment the localRepository and set the value to your local dependency repository
    • If there is no dependency package locally, it is best to configure as a remote warehouse, this step can be omitted
      <localRepository>E:\Maven\repository</localRepository>
    
         
        
        
    • 1

    My local warehouse:
    Insert picture description here

  • Next, configure the remote dependency package repository, here 阿里云is an example

<mirrors>
    <mirror>
        <id>nextus-aliyun</id>
        <mirrorOf>*</mirrorOf>
        <name>Nexus aliyun</name>
        <url>http://maven.aliyun.com/nexus/content/groups/public</url>
    </mirror>
</mirrors>

   
  
  

Insert picture description here
Just click save after modification

6. Open Idea and configure the relevant parameters of maven

  • Click file-click settings-search for maven, start to configure options After
    Insert picture description here
    configuration is complete, click apply to complete!

7. Create a maven project and test the guide package


Guide package example
There is no problem when trying to import hive and hdfs , indicating success.
At the same time, you can view more information about the package on the right side of the project.
Insert picture description here

Guess you like

Origin blog.csdn.net/WA_MC/article/details/114606682