Eclipse builds MAVEN development environment

Source: Internet
Author: User

The previous article learned about the MAVEN development environment, and manually wrote a mavenproject, but this is very inefficient. Today we are learning to build a MAVEN development environment under Eclipse.

Frequently used MAVEN commands
    1. MVN clean: Performs a cleanup operation that deletes data from the target directory
    2. MVN Clean Compile: Performs a cleanup operation before compiling the code into the target directory.

    3. MVN Clean test: Performing cleanup and testing
    4. MVN Clean Package: performing cleanup and packaging
    5. MVN clean install: Perform cleanup and installation. The packaged files are installed in the local repository so that other modules or projects can be configured to call the
    6. MVN Clean Deploy: Performs cleanup and advertisement, which is published to the private server.
Create a project using MVN archetype

Until now. We already know that the Java class is stored in the fixed path "Src/main/java" directory. The test class is stored in the "src/main/test" directory by default. It would be very troublesome to create these directories manually each time, but fortunately. MAVEN has provided us with a "maven archetype" to build the skeleton of the project.

This is the fixed directory and the Pom.xml file.

We create a new project "Test003", which is entered into the directory under the command line. Enter this command: "MVN archetype:generate", you can create a project.

The first time you create project you need to go to Maven's central repository to download something. It might be slower, and then you can see that when you use "MVN archetype:generate" to create project, you are prompted to enter some basic information about the project and what you need in the Pom.xml file:
GroupId
Artifactid
Package
Version

Be able to see the main required directories as well as the pom.xml files. MAVEN has been created for us on our own initiative.

Eclipse Configuration Maven Plugin

First you need to download the M2eclipse offline package. After the download is complete. Decompression has for example the following two directories:

Copy the appropriate file from the directory in the directory to the appropriate directory in the Eclipse installation directory, and then restart Eclipse. You can see the MAVEN option when you start clicking Window->preferences.


Configure your own Maven

Until now, you need to configure your downloaded Maven into eclipse.

Configure the location of the local warehouse

M2eclipse Offline Package

Eclipse builds MAVEN development environment

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.