工欲善其事-maven Introduction and use

Source: Internet
Author: User

What is maven?

MAVEN is a project management and integration tool. MAVEN provides developers with a complete life cycle framework. The development team can automate the construction of the project's underlying tools, MAVEN uses the standard directory structure and the default build life cycle.

In multiple development team environments, MAVEN can set up the configuration work in a very short time by standard. Because most projects are easy to set up and reusable, MAVEN makes it easier for developers to create reports, check, build, and test automation settings.

MAVEN provides a way for developers to manage:

    • Builds

    • Documentation

    • Reporting

    • Dependencies

    • SCMs

    • Releases

    • Distribution

    • Mailing list

In summary, Maven simplifies and standardizes the project construction process. Handles the seamless connection of compilation, distribution, documentation, team collaboration, and other tasks. Maven increases reusability and is responsible for building related tasks.

The focus is on the management of large Java projects. Automated build tools. Provides the concept of a warehouse to avoid scenarios where the project cannot run because of changes in the environment.

Maven Download Catalog: http://maven.apache.org/download.cgi

Now zip, unzip directly, configure the system environment variable, it can be used. Verify the success of the DOS environment, enter mvn-v view.

Write the following pom 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/maven-v4_0_0.xsd">    <modelversion>4.0.0</modelversion>    <groupId>Com.accipiter</groupId>    <Artifactid>Hello</Artifactid>    <Packaging>Jar</Packaging>    <version>1.0</version>    <name>Hello</name>    <URL>http://maven.apache.org</URL>    <Dependencies>        <Dependency>            <groupId>Junit</groupId>            <Artifactid>Junit</Artifactid>            <version>4.11</version>            <Scope>Test</Scope>        </Dependency>    </Dependencies>        <Build>      <Plugins>        <plugin>            <groupId>Org.apache.maven.plugins</groupId>            <Artifactid>Maven-compiler-plugin</Artifactid>            <version>2.3.2</version>            <Configuration>                <Source>1.6</Source>                <Target>1.6</Target>            </Configuration>        </plugin>      </Plugins>    </Build>    </Project>
View Code

GroupId: Package name. Artifactid: module name. The POM is placed in the project root directory.

    1. Compile using the MVN compile command.
    2. Use the MVN Test command to run inside the test.
    3. Use the MVN Package command to generate a jar.
    4. Use MVN clean to remove target.
    5. Install the jar package to the local repository using the MVN installation.
    6. The MAVEN project directory is automatically generated using the MVN archetype:generate-dgroupid=-dartifactid=-dversion=-dpackage= command.

Eclipse installs the Maven plugin, which allows you to compile, package, and build your project directly in Eclipse. The result is the same as the command.

工欲善其事-maven Introduction and use

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.