Get started with Maven and get started with maven

Source: Internet
Author: User

Get started with Maven and get started with maven
Maven-related commands

Mvn archetype: create a Maven Project

Mvn compile: compile the source code (to the target folder)

Mvn test-compile: compile the test code

Mvn test: run the unit test in the application.

Mvn site: the website that generates project-related information

Mvn clean: Clear the generated results in the target directory (clear the data in the default target folder)

Mvn package: Project Packaging

Mvn install: install the packaged package in the local repository so that its tower project can call

Mvn eclipse: generate an Eclipse project file

Mvn-Dmaven. test. skip = true: Ignore test document compilation

Cargo: deploy to private server

Of course, these commands can be used together as follows:

1. Download Maven

Http://maven.apache.org/download.cgi

Click Download, download, directly decompress, and put the extracted apache-maven-3.5.2 folder in the place you want to put, and then configure the environment variables on the line.

Ii. install and configure Maven

Consistent with jdk Environment Variables

 

Test: Open the cmd window and enterMvn-versionIf the following information is displayed, the configuration is successful.

 

3. Modify the location of the local repository

The default local repository location of maven is/. m2/repository in the current user directory. We can configure it to another disk.

Configuration File Location:

Configure the location of the local repository to be saved

 

OK. First, let's get to know maven. In cmd, press enter and execute: mvn help: system.

At this time, maven will start to download a lot of things from the remote repository. It's okay to let it download. It will be downloaded sooner or later. Next we will install the maven plug-in eclipse,

One of the most obvious differences between using eclipse and using myeclipse is that in eclipse, you need to install many plug-ins, such as highly integrated tools such as myeclipse,

It is better not to use too much. I just want to talk about it. For eclipse or myeclipse, you should choose your own environment.

 

4. Configure the maven plug-in of Eclipse

There are two most common ways to install plug-ins in eclipse:
The first method is online installation, which seems to be the most commonly used, namely: Help --> Install New Software, and then enter the HTTP address for installation. However, there is an obvious drawback, slow!

Enter the http address: http://m2eclipse.sonatype.org/sites/m2e. check the hosts and wait until the installation is downloaded. After installation, restart eclipse.

Method 1:

Open eclipse and choose "Help"> "Install New Software ..."

  

Restart Eclipse and go to Window ---> Preferences. If Maven option is added. Indicates that the Maven plug-in is successfully configured. As shown in:

Configure maven plug-in

1,

 

2. Click the Browse button, select the setting. xml configuration file of maven, and click OK to complete the configuration of the eclipse maven plug-in.

 

Method 2: Install the plug-in offline and install the plug-in using link. The plug-in can be plugged in and unplugged at any time, which is very convenient. The official website does not provide offline installation packages for maven plug-ins. Generally, you can search for them online. If you are lucky, you can find them.

For detailed steps, go to the following steps: how to install Maven plug-in Eclipse

5. Use maven to create a web project in eclipse

 Reference URL:Https://www.cnblogs.com/tenglongwentian/p/5564359.html

6. Use IntelliJ IDEA 15 and Maven to create a Java Web project

Reference URL:Http://blog.csdn.net/myarrow/article/details/50824793

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.