1. Maven environment configuration
1.1 Download Apache Maven (apache-maven-3.5.2.zip) from http://maven.apache.org/download.cgi
1.2 Unzip, for example: E:\Tools\maven, at this time there should be E:\Tools\ maven\apache-maven-3.5.2, indicating that Maven has been decompressed
successfully Add %M2_HOME%\bin
1.4 Maven default configuration
- Global configuration file: %M2_HOME%\conf\settings.xml
- User profile: ${user.home}/.m2/setting.xml
- The default path of the local repository: ${user.home}/.m2/repository.
In order to update the Maven aspect, the path to the repository is often changed by modifying ${user.home}/.m2/setting.xml, as follows:
<localRepository>E:\Tools\maven\repositories</localRepository>
After modification, the package associated with the Maven project will be automatically obtained to E:\Tools\maven\repositories.
The next time you update the Maven version, just overwrite E:\Tools\maven\apache-maven-3.5.2, and then modify the configuration file.
2. Maven configuration in Eclipse
2.1 Select Preferences --> Maven --> Installations --> Add button, select the Maven path installed in 1.
2.2 Select Preferences --> Maven --> User Settings
- Set Global Setting to E:\Tools\maven\apache-maven-3.5.2\conf\settings.xml
- Set User Setting to E:\Tools\maven\settings.xml
- Set Local Repository to E:\Tools\maven\repositories
After setting Eclipse will use the Maven version installed in 1 instead of the Maven version that comes with it. You can modify it accordingly according to the path where you place Maven.