Foreword Many of the projects we develop are MAVEN projects, which makes it easier to manage our jar packages. And we generally use the IDE is eclipse, because we in the daily development process will often use some maven, so I would like to share with you today on our daily development of maven practical little knowledge, so that people no longer foggy. Installation configuration maven 1. Install maven, download a MAVEN package decompression, and then configure the MAVEN environment variable (after the configuration is complete, test with the MVN command in the DOS window). 2. Install the Maven plugin in Eclipse, the MAVEN plugin is installed online at: http://m2eclipse.sonatype.org/sites/m2e. 3. Configure Maven Setting.xml in Eclipse, that is, in preference--"maven--" User Configuration in setting (which setting.xml to use depends on your project situation). 4. Copy the repository package, although this is not necessary, generally through the project online update jar package can be, but if the first time it is best to copy, because the general project will be relatively large, the jar package will be many, the online download will be very slow. introducing and installing MAVEN projects If the first step is successful, You can see the MAVEN options in the Import window and choose Import a exsiting maven project, if you first down the MAVEN project from the repository. If you introduce this project A is referenced by another MAVEN project B, then we'd better let Project B use the local project a directly instead of looking for the jar package for project A from repository. This avoids problems with the JAR package update (for example, item A is updated frequently and the jar package may not be updated in time). In this case we will need to install our project A to local, install there are two ways: 1. Right-click Project to select Maven MenuThe install can be. 2. Use the command to convert the directory to the project directory, then execute MVN clean install-dmaven.test.skip=true. (This method is recommended because it skipped the test) update jar package Updating MAVEN's jar package should be the most common operation for MAVEN projects (because the project is constantly being updated, the jar package must also be changing). Update MAVEN's jar package by right-clicking on the project under the Maven menu and then having a offline option in the popup box. In general, we tick offline (so that it updates the local jar package, such as the above mentioned item a changes will be updated, offline fast), of course, if offline can not, you need to cancel the offline check, that is, online update jar package, This will download the latest jar package from the remote server. Common minor issues Although it may seem simple in a few steps above, there are often minor problems due to the fact that our Maven plugin is not very useful. 1.install Project Failure This situation typically occurs when you use the right-click Project Install method because it has a test process, so sometimes the test fails, At this point we just need to switch to the second way of using the install command. 2. Update jar package Failure There is often a case where the jar package is updated online, but the jar package is still a long time ago, Then, when you start Tomcat, you always report ClassNotFound or a method that doesn't exist. For this situation we'd better find out which package it is, and then find the package in repository and delete it, then update it then the package will be up to date. 3. The project is inexplicably not bootable Sometimes I have updated the jar package online, and then clean the project, but it is the boot lossDefeat, look carefully, problems window has the error prompt, what cycle reference, this time is generally because there is a reference to the local installation of the project and the reference repository in the jar package, So maybe your repository is up-to-date, but the project you're referencing locally is not updated, and my worry-free approach is to: Update all of the referenced items (remember to modify the JDK after update), Then clean, then reinstall (preferably using command mode), and then update your project to clean, basically no problem. Transferred from: http://blog.csdn.net/huaweitman/article/details/50676573
Maven's practical tips in eclipse