Java-maven Project Management

Source: Internet
Author: User

    • MAVEN is a software project management tool that enables you to manage project builds, reports, and documents through a small section of information that is based on the Project object Model (POM).
    • MAVEN Environment Setup

http://maven.apache.org/download.cgi download Apache-maven-3.5.0-bin.zip, unzip to a directory

To configure environment variables:

is configured successfully:

  

    • A case of Maven

1.maven directory structure:

src     -main        -java            -Package    -test        -java            -  Package    Resources

2. In the root directory (same as SRC sibling), add the Pom.xml file

<Projectxmlns= "http://maven.apache.org/POM/4.0.0"Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"xsi:schemalocation= "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">    <modelversion>4.0.0</modelversion>    <groupId>Com.test.maven01</groupId>    <Artifactid>Maven01-model</Artifactid>    <version>0.0.1SNAPSHOP</version>
   <!--test the code with the JUNIT4 framework and need to import JUnit's dependency-- <Dependencies> <Dependency> <groupId>Junit</groupId> <Artifactid>Junit</Artifactid> <version>4.10</version> </Dependency> </Dependencies></Project>

Note: groupId: Organizational identity, which is the package name of the project.

Artifactid: module name, for example: My-project, in M2_repo directory, will be: Org/codehaus/mojo/my-project directory.

Version: Revision number. Example: Napshop is a snapshot version

3. Use the command line to perform the following:

MVN compile to compile a project

MVN Test Run Tests case

MVN package, the project is packaged into a. jar file.

After the execution completes, in the root directory, generate some files:

  

  

MVN clean Deletes the target directory that MAVEN produces

MVN Install the jar package into the local repository

    • Two ways to create a table of contents

1.MVN archetype:generate Follow the prompts to select

Define value forProperty'groupId': Com.test.maven03Define value forProperty'Artifactid': maven03-Servicedefine Value forProperty'version' 1.0-snapshot::1.0. 0SNAPSHOTDefine value forProperty' Package'com.test.maven03:: Com.test.maven03.serviceConfirm properties Configuration:groupid: Com.test.maven03artifactId:maven03-serviceversion:1.0. 0snapshotpackage:com.test.maven03.service y:: Y

2.MVN archetype:geenrate-dgroup= organization name, anti-write of company URL + project name

-dartifactid= Project Name-module name

-dversion= Version number

The package name that is present in the-dpackage= code

The last directory created automatically:

  

Java-maven Project Management

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.