Article Directory
"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
- To use maven in eclipse, first set:
"2.1.2 Maven Core Concepts"
Commonly used commands:
"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
-
Dependency transfer leads to easy dependency conflicts. Rely on conflict resolution:
-
- Declare first: take precedence
<dependency>
in the former
- Declare first: take precedence
-
- Short-circuit priority: rely on passing shorter priority
-
- Dependency exclusion:
- Dependency exclusion:
-
- 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"
Compile, test, package, install, these commands will include the previous commands.
"2.1.5 Maven aggregation and inheritance"
- polymerization:
<modules>
<module>ssm-dao</module>
<module>ssm-service</module>
<module>ssm-web</module>
</modules>
- Inheritance:
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:
- Set the username and password in the maven settings.xml file to connect to the private server:
- 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
- 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: