“This article has participated in the call for good writing activities, click to view: the back end, the big front end double track submission, 20,000 yuan prize pool waiting for you to challenge!”
- Maven:
1. Nature:
A tool that automates building projects and managing project dependencies
Configuration add and manage:
2. Environment configuration:
Configure the PATH environment variable to configure the JDK environment:
MAVEN_HOME= URL;
mvn -version
Copy the code
Basic configuration of IDEA: Maven creation mode
Remote warehouse download:
https://mvnrepository.com/
Copy the code
Main demonstration of dependencies:
<dependency> <groupId>cn. Hutool </groupId> <artifactId>hutool-all</artifactId> <version>5.6.3</version> </dependency>Copy the code
Clean,compile for Maven and compile for Tomcat
maven.apache.org/
<plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> < version > 3.5.1 track of < / version > < configuration > < source > ${java.com piler. Source. Version} < / source > <target>${java.compiler.target.version}</target> <encoding>${project.encoding}</encoding> </configuration> </plugin> Maven-source-plugin </artifactId> <version>3.0.1</version> <configuration> <attach>true</attach> </configuration> <executions> <execution> <phase>compile</phase> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin> <! -- Modify the project version uniformly, command: MVN versions: set-dnewVersion = 1.0.0-release --> <plugin> <groupId>org.codehaus.mojo</groupId> < artifactId > versions - maven plugin < / artifactId > < version > 2.7 < / version > < configuration > <generateBackupPoms>false</generateBackupPoms> </configuration> </plugin> <plugin> . < groupId > org, apache maven plugins < / groupId > < artifactId > maven - surefire - plugin < / artifactId > < version > 2.18.1 < / version > <configuration> <includes> <! Java </include> </includes> </configuration> </plugin> </plugins>Copy the code
Some configuration files for POM.xml, where plugins stand for plug-ins
https://tomcat.apache.org/maven-plugin.html configure tomcat, based on the common project < plugin > < groupId > org.. Apache tomcat. Maven < / groupId > < artifactId > tomcat7 -- maven plugin < / artifactId > < version > 2.2 < / version > < / plugin > < / plugins >Copy the code
How Maven starts a project:
First, after configuring the Tomcat plug-in, run the command to start it
Tomcat for Maven is started
3.BAtch Mode:(the project stops construction)
Configure domestic Ali Cloud image server:
setting.xml
<mirror>
<id>alimaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
Copy the code
4. Maven download address and file directory:
Download address:
Maven.apache.org/download.cg…
5. Maven basic operations:
A warehouse, usually a company that has private servers:
Create a local repository: conf/setting.xml;
<localRepository>D:\RepMaven</localRepository>
Copy the code
After the configuration is complete, save and then IDEA is reconfigured to update Maven
5.1 Core Configuration of Maven:
Global configuration file :setting.xml
Servers — Configure the identity information accessed from the server where the remote repository resides,
For project-specific customization, such as JDK versions
Project configuration: POM.xml
5.2 GaV coordinates of Maven
5.3: Maven command
Package and store it in the target directory;
MVN: package package — Configures whether a WAR package is available
MVN: Install to the local repository
6: Maven lifecycle:
Maven’s practical applications:
Dependency conflicts for Maven:
Project dependency direct conflict:
Jar packages that can conflict with S are excluded directly from S