The understanding of Maven
We know that Maven is a project management tool whose core feature is the dependency management of the jar package through MAVEN, the consistency of the jar package version, and the ability to share jar packages across multiple projects to reduce the size of the project when developing large Java applications, and MAVEN based on The "contract is better than the configuration" feature allows for a more abstract encapsulation of the compiled and packaged deployment of its project, and we can directly use the system's pre-scheduled MVN clean,package and other commands for project operation. So I used maven in my last project to make sure that the members of the team were able to save the time it took to download the jar, so I used the Nexus to build the Maven on the LAN, The mirror image is then configured in settings.xml to forward all requests to download the jar package to the MAVEN, and then, by configuring the jar packages that the project depends on in Pom.xml, Project object model. In order to achieve in the construction of the project, first from the local repository, if not exist from the internal server lookup, if there is no mechanism to find the last from the external network servers, to save download bandwidth, improve development efficiency, and the purpose of jar package reuse.
Let's briefly talk about the application of Maven, and hope to help you.
First step: download maven
1. Baidu Search maven keyword to enter the official website
2. Click the Download keyword in the official dot, go to the Download list page
3. On the Download list page, click on the item I selected to download
4. Download the package after the zip is the following look
Step Two: configure and verify Maven
1, unzip the above compression package open
2. Enter the bin directory using the DOS command: mvn-version This command, the following results show that the MAVEN installation was successful
Step Three:
Integrate Maven and eclipse into a 1, open Eclipse----> Click window----> Click Preferences 2, click Maven (1), and then click Installations (2), In the right-hand window, click the Add button to select Maven's decompression path (the upper layer of the bin), and tick before your MAVEN configuration
3. Configure the Local warehouse
3.1. Modify Maven settings.xml files
3.2. Open the file for the following changes (configure the address of the local repository, write the absolute path)
4. Configure the Local repository (3) in Eclipse and select the Maven settings.xml file by clicking on the button on the back of global settiings in the right window
Fourth Step:
The package structure of the project that Maven created (the contract is better than the configuration) the Java code for the Src/main/java project is in this package
The configuration files for the Src/main/resources project are in this package
The test Java code for the Src/test/java project is in this package
Src/test/resources (typically default) the test configuration file for the project is in this package
Pom.xml dependency configuration information for a file project
Web project is the above structure Java project does not exist resources package
Fifth Step:
Use MAVEN to create a Java Project 1, right-click in the blank of the project list---->new----->other 2, enter MAVEN in the input box, select Maven Project, click the Next button, click Next Next
3, select QuickStart This option (this represents the Java project), click Next Next
4, remember coordinates (project coordinates), improve the coordinate information, directly click Finish to complete the creation of the project, the first time the process is a bit slow, will be networked download a bunch of jar package
GroupID: Group information for a project
Artifactid: Name information for the project
Version: Project release information above three information determines where a project is located
5. Modify the JDK information that the project relies on
6. Modify the version information at compile time of the project
Sixth step:
Create a Web project using maven the step is exactly the 3rd step, and this is the place to choose the last item (WEBAPP)
Seventh Step:
Setting up a maven (Nexus)
1, download the software, Baidu search Nexus Maven selected official website and open
2. Open the OSS option in download (Open source software)
3, select the version you need, click to download
4, after downloading is a zip compressed package, as follows
5. Unzip the compression pack
6. Register and start the service
7. Verify that the service is available (default port 8081 for this service) open the browser, enter: Http://localhost:8081/nexus, the following page appears to prove that the service is working properly
8, click on the 2 this login button, you can access the console, user name default: admin, password default: admin123
9. Configure your own and create proxies
Eighth Step:
Configure the Local 1, open maven settings.xml file in your own maven, and modify the following image content
Nineth Step: Complete All
Maven summary, integrate eclipse and configure