Maven environment configuration and maven Environment

Source: Internet
Author: User

Maven environment configuration and maven Environment

I have studied how to build a maven project. The following describes how to build a maven project.

1. Download maven

Click to enter http://maven.apache.org/download.cgi? .

2. Deploy maven

Right-click computer Properties

 

Advanced System settings-system properties-environment variables-create MAVEN_HOME and set the variable to the local maven address

Enter the path environment and add; % MAVEN_HOME % \ bin at the end of the variable value;

Test whether maven configuration is successfulOpen the command line window and enter mvn-v. If maven version information is output, the configuration is successful. Otherwise, check whether your configuration path is correct.

Note:Before installing maven, ensure that JDK is installed and its environment variables are successfully configured.

3. Modify the maven local repository

Introduction: A local repository is a buffer and subset of a remote repository. When you build a Maven project, you first need to find resources from the local repository, then Maven will download from the remote repository to your local repository. In this way, you do not need to download it from the remote connection next time. If the jar package version you need does not exist in the local repository and does not exist in the remote repository, Maven will report an error during building, this may be because the new versions of some jar packages are not updated in the Maven repository in a timely manner.

The default maven address is found in the m2 \ repository folder under C: \ Users \ Administrator. You can modify setting. xml to modify the default address.

Operation:

1. Find the setting. xml file in the conf folder of maven.

2. added in the setting. xml file, indicating that the address of the local repository is D: \ m2 \ repository)

<LocalRepository> D: \ m2 \ repository </localRepository>
3. Copy setting. xml to the Directory D: \ m2 \ repository.
4. Modify maven configuration in eclipse
Open eclipse and click windows-> preferences-> maven-> installations to add a maven that has been installed in the D: \ maven \ directory, such as: D: \ maven \ apache-maven-3.3.3, select this add item. And click the following browse button to open the maven global configuration file, such as: D: \ maven \ apache-maven-3.3.3 \ conf \ setting. xml
5. Modify the default jdk version of maven.
Actually token
1. Find the setting. xml file in the conf folder of maven.
2. Add the following code under the setting. xml file

<Profiles>
<Profile>
Jdk-1.8
<Activation>
<ActiveByDefault> true </activeByDefault>
<Jdk> 1.8 </jdk>
</Activation>
<Properties>
<Maven. compiler. source> 1.8 </maven. compiler. source>
<Maven.compiler.tar get> 1.8 </maven.compiler.tar get>
<Maven. compiler. compilerVersion> 1.8 </maven. compiler. compilerVersion>
</Properties>
</Profile>

<Profiles>

3. Right-click maven project> maven> updateproject.




Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.