Maven notes (2)-Common commands and standard Maven project structure

Source: Internet
Author: User

1. Common commands

1) create a project

 

 
MVN archetype: generate-dgroupid = com. mycompany. app-dartifactid = My-app-darchetypeartifactid = Maven-Archetype-Quickstart-dinteractivemode = false

 

MVN archetype: Generate fixed format

-Dgroupid: Organization ID (package name)

-Dartifactid project name

-DarchetypeartifactidSpecify Archetypeid, Maven-Archetype-Quickstart, creates a Java project; Maven-Archetype-webapp, creates a WEB Project

-dinteractivemode: whether to use interactive mode

2) CompileSource code

 
MVN compile

3) Compile and TestCode

 
MVN test-compile

4) Clear

 
MVN clean

5) run the test

 
MVN Test

6) Create and package the site directory

 
MVN site-deploy

7) install the output file of the current project to the local repository.

 
MVN install

8) Packaging

 
MVN package

9) Clear and then package

 
MVN clean package

10) compress it into a jar package

 
MVN jar: jar

11) generate an Eclipse project

 
MVN Eclipse: Eclipse

12) view help information

 
MVN help: Help

13) view the types of Maven Projects

 
MVN archetype: generate-darchetypecatalog = intrenal

 

 

2. Standard Maven project structure

Src/main/Java stores the source code of the project

Src/test/Java: store test source code

To store some configuration files, you can create another directory src/main/resource for storage, such as log4j. properties.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

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.