Configure and use maven
I. First, let's take a look at maven.
Maven is an open-source project management tool written in pure Java. Maven adopts a concept called project object model (POM) to manage projects. All project configuration information is defined in a project called POM. in an xml file, Maven can manage the entire declaration cycle of a project, including compiling, constructing, testing, releasing, and reporting. Currently, Maven is used to manage most projects in Apache. Maven also supports multiple plug-ins to facilitate more flexible project control.
2. We will download the latest maven package here (http://maven.apache.org/download.cgi)
Right-click link in the Red Circle to download the zip package.
3. decompress the maven package to the specified disk directory, such as: (D: \ company \ maven \ apache-maven-3.2.3)
Iv. environment variable configuration
(Here, we need to note that the ";" number should be reflected in the path. Another point is that if the configuration in win7 fails, change the MAVEN_HOME in front of the path to the absolute path D: \ company \ maven \ apache-maven-3.2.3.
)
MAVEN_HOME: D: \ company \ maven \ apache-maven-3.2.3 add % MAVEN_HOME % \ bin before path; (optional) MAVEN_OPTS:-Xms256m-Xmx512m
5. verify whether the installation is successful
Enter mvn-version on the command line, and press Enter. If the following information is displayed, the installation is successful:
Vi. Install maven in eclipse
Open eclipse -- help --> install new software --> add --> name input maven, location input http://download.eclipse.org/technology/m2e/releases
Click Next and select the part to be installed.
Verify whether the installation is successful:
File, enter the filtering condition maven, and check the maven option, indicating that the installation is successful.
7. Use the eclipse maven plug-in to create a project
1. Select maven project2 for the new project to create a simple project. 3. Enter the basic information.
Click finish. The generated directory structure is as follows:
8. How to depend on each other in different projects
Add in pom. xml
<Dependencies>
<Dependency>
<GroupId> bms. mybaties </groupId>
<ArtifactId> bms. mybaties </artifactId>
<Version> 0.0.1-SNAPSHOT </version>
</Dependency>
</Dependencies>
In this way, the referenced project will obtain a jar package from the project I created above. When the startup and the jar project are changed at the beginning of the server
Maven configuration is all right, And JDK is also configured correctly. Why can't I view the Maven version using commands in the DOS window?
In some Shanzhai versions, maven uses the command-type maven-v.
The official version is mvn-v. Which one do you use?
How to configure maven configuration to download jar Library 10 locally
A common method is to install your own private jar to the local maven library. For public jar files, you can download them from remote repository. Mvn install: install-file \-Dfile = yourcompany-yourproject-1.0.jar \-DgroupId = yourcompany \-DartifactId = yourproject \-Dversion = 1.0-Dpackaging = jar other open source dependencies are directly written to pom. xml.