current position:Home>Installation and use of Maven (idea version)

Installation and use of Maven (idea version)

2022-01-26 22:54:58 #HashMap#

Maven Installation and use (IDEA2020.1)

1.Maven Installation

Maven Download address :http://maven.apache.org/download.cgi
1) Open the official website and select as shown in the figure
 Insert picture description here 2) After downloading, unzip it to the installation directory of your choice , I installed E:\apache-maven-3.6.3-bin\apache-maven-3.6.3, Pictured
 Insert picture description here
3) The next step is to configure environment variables , This is actually related to configuration jdk equally , Start by opening " Control panel ", find " Advanced system configuration "
 Insert picture description here 4) find " environment variable " newly build MAVEN_HOME, The content is installed for you MAVEN Catalog ( That's the second step )
 Insert picture description here  Insert picture description here 5) edit path, find "path" Click on " edit ", hold %MAVEN_HOME%\bin; Add in , Be careful not to lose the semicolon
 Insert picture description here 6) And finally we use Win+R stay doc The window validates the input mvn -v Command to see if it succeeds
 Insert picture description here
7)Maven Local warehouse and Alibaba cloud image , Found installed Maven In the catalog conf Folder , open setings.xml File modification .
The first is to find localRepository label , I'm on my own E Created under the disk RepMaven Folders are used to store local warehouses , The configuration is as follows

<localRepository>E:\RepMaven</localRepository>

 Insert picture description here
The second is to find mirrors label , The configuration is as follows

<mirror>
      <id>alimaven</id>
      <name>aliyun maven</name>
      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
      <mirrorOf>central</mirrorOf>        
    </mirror>

 Insert picture description here

The third is to find profiles label , Add the configuration

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

 Insert picture description here

 Insert picture description here  Insert picture description here
8) And then in IDEA Download the downloaded Maven Import , Pictured
 Insert picture description here  Insert picture description here  Insert picture description here 9) And then we have IDEA Import your own Maven, Operation and 7) identical , It's just a different path
 Insert picture description here  Insert picture description here

2.Maven stay IDEA The use of

1) First let's open up IDEA, choice "Create New Project", choice "Empty Project", Click on "Next", Pictured
 Insert picture description here  Insert picture description here 2) Create project name and modify workspace , Pictured
 Insert picture description here  Insert picture description here 3) Next create Models, Click on "File"->“New”->“Models”, And then choose "Maven" project , Click on "Next"
 Insert picture description here  Insert picture description here

4) Here we create a Hello Project , Then modify the workspace , After successful creation, there are the following files in the project . Then we can go through pom.xml Import dependencies in for coding
 Insert picture description here  Insert picture description here

The above contents can be referred to :https://www.bilibili.com/video/BV1Te411W7N6?p=9

copyright notice
author[#HashMap#],Please bring the original link to reprint, thank you.
https://en.cdmana.com/2022/01/202201262254555851.html

Random recommended