MAVEN Learning 1-Installing MAVEN and executing the compile command

Source: Internet
Author: User

One. Maven download and install (with JDK installed)

1.:http://maven.apache.org/download.cgi (select latest zip version), unzip after download

2. Install: The system path variable is followed by the MAVEN bin path, or you can configure the maven_home system variable (%maven_home%\bin) to operate

3. Run the cmd command to view the installation status Mvn-v

Two. Create a new MAVEN project manually, using MAVEN to compile

(Maven project key is in the Pom.xml file)

1. Create a project directory and create a new folder (e.g. Maven_test)

2. Enter the Maven_test and create the Pom.xml file (only name plus pom?). ), and add the project basic information

    

1<?xml version= "1.0" encoding= "UTF-8"?>2<project xmlns= "http://maven.apache.org/POM/4.0.0"3Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"4Xsi:schemalocation= "http://maven.apache.org/POM/4.0.05http//maven.apache.org/xsd/maven-4.0.0.xsd ">6<!--all MAVEN projects must have these four configuration items configured--7<modelVersion>4.0.0</modelVersion>8<!--GroupID refers to a project group with the project name, which by default is the package name--9<groupId>cn.com.maven.test</groupId>Ten<!--Artifactid refers to a module in a project that is named by the project name-module name-- One<artifactId>test</artifactId> A<!--version refers to versions, where Maven's snapshot version is used-- -<version>SNAPSHOT-0.0.1</version> -</project>

3. Create a new src directory (folder) within the Maven_test Project (folder)

4. Create a new main directory (folder) within the SRC Directory (folder)

5. Create a new Java Directory (folder) within the main directory (folder)

6. Create a new Java file within the Java Directory (folder)

7. Run the cmd command into the Maven_test directory to run the mvn compile command to compile the project

8. After compiling with MAVEN, a target folder is generated under the project root directory

9. Open the target folder, you can see there is a Classes folder, Classes folder is compiled after the successful generation of the. class file

  10. Use the "mvnClean" command to clear the compilation result, which is to delete the target folder generated by the compilation

Three. Modify the location of MAVEN storage

1. Open the Maven directory, locate the Conf folder, open

2. Locate the Setting.xml file and add the following configuration

<localRepository> the location you want to store such as F:/maven_libs </localRepository>

Learn the Great God Blog: http://www.cnblogs.com/xdp-gacl/p/3498271.html

Maven Learning 1-install MAVEN and execute the build command

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.