old《maven》

"2.1.1 Introduction to maven"

  • To create a maven project from the command line, please refer to the official website Maven in 5 Minutes . For example, enter the command:mvn archetype:generate -DgroupId=com.netease -DartifactId=mvndemo1 -Dversion=1.0-SNAPSHOT -Dpackage=com.netease -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false
    Insert picture description here
  • To use maven in eclipse, first set:
    Insert picture description here
    Insert picture description here

"2.1.2 Maven Core Concepts"

Commonly used commands:
Insert picture description here

"2.1.3 maven dependency scope"

  • The default is compile. <scope>provided</scope>The dependency will not be included when the project is packaged. Often used when the package already exists in the environment
    Insert picture description here

  • Dependency transfer leads to easy dependency conflicts. Rely on conflict resolution:
    Insert picture description here

    • Declare first: take precedence <dependency>in the former
    • Short-circuit priority: rely on passing shorter priority
    • Dependency exclusion:
      Insert picture description here
    • Version lock:
<dependencyManagement>
  	<dependencies>
  		<dependency>
  			<groupId>org.springframework</groupId>
  			<artifactId>spring-beans</artifactId>
  			<version>5.1.5.RELEASE</version>
  		</dependency>
  	</dependencies>
  </dependencyManagement>

"2.1.4 maven life cycle and plugins"

Insert picture description here
Compile, test, package, install, these commands will include the previous commands.

"2.1.5 Maven aggregation and inheritance"

  • polymerization:
    Insert picture description here
  <modules>
  	<module>ssm-dao</module>
  	<module>ssm-service</module>
  	<module>ssm-web</module>
  </modules>
  • Inheritance:
    Insert picture description here
    Me: The parent project of compile will also compile its submodules; the dependent submodules of the parent project will also have.

"2.1.6 maven private server setup"

  • Install private server with nexus:
    Insert picture description here
  • Set the username and password in the maven settings.xml file to connect to the private server:
    Insert picture description here
  • Set the private server warehouse address in the pom file of the project to be uploaded to the private server. Note that the id should be the same as in the figure above
    Insert picture description here
  • Use maven's deploy command to upload private servers
  • Set the private server warehouse address in the project that you want to reference the private server package:
    Insert picture description here

Guess you like

Origin blog.csdn.net/qq_23204557/article/details/112590228
Old