Basic concepts and methodologies for project construction based on Apache Maven 3

Source: Internet
Author: User
Keywords Apache Basic concepts Maven project building
Tags aliyun apache application based basic basic concepts code cross

This article describes the basic concepts and methodologies for building a project based on http://www.aliyun.com/zixun/aggregation/14417.html ">apache Maven 3." Maven is a set of standard project building and management tools, using a unified normative script for project building, easy to use, discarding the cumbersome building elements in Ant, and highly reusable. After reading this article, you will learn about the basic concepts of Maven and the basic methods used to build your project.

What is Maven

Maven is a Cross-platform project management tool under the Apache organization that is designed to help you build, test, package, and deploy your projects. Maven provides a standard software lifecycle model and build model that enables comprehensive management of projects through configuration. Its cross-platform nature guarantees that the same commands can be used on different operating systems to accomplish the task. Maven abstracts the process into a lifecycle process, using different implemented plug-ins to do the actual work at different stages, which greatly avoids the duplication of design and scripting code, and greatly realizes reuse.

Maven vs Ant

Ant is also a Cross-platform project building tool under the Apache organization, a task-based and dependent build system that is process-based. The developer needs to display each task, each containing a set of XML-encoded instructions that must be explicitly told in the instruction where the Ant source is, where the resulting bytecode is stored, and how these bytecode are packaged into a JAR file. Ant has no lifecycle, you have to define dependencies between tasks and tasks, and you need to manually define the execution sequence and logical relationships of tasks. This virtually creates a lot of code duplication.

Maven is not only a project building tool, but also a project management tool. It has the agreed directory structure (table 1) and lifecycle, the various phases of project construction are implemented by Plug-ins, developers just follow the agreed directory structure to create the project, and then configure the basic elements of the Life project in the file, Maven will complete the entire build process in sequence. These features of Maven greatly reduce code duplication to some extent.

Table 1. Maven directory Structure

Src/main/java application/library sources src/main/resources application/library Resources Src/main/filters Resource Filter Files src/main/assembly assembly descriptors src/main/config revisit files src/main/scripts application/li Brary Scripts Src/main/webapp Web creator sources Src/test/java test sources src/test/resources test resources SR C/test/filters Test Resource filter Files Src/site site LICENSE.txt project ' s LICENSE README.txt project ' s README

Maven Installation and basic settings

This article describes the installation of Maven on the Windows platform. Maven 3 needs to run above JDK1.4 versions.

First make sure that the JDK is installed on your system and that the Java environment variables are set correctly. Maven's download address is: http://maven.apache.org/download.cgi. Extract the downloaded file into the specified directory, such as C:\Maven-3.0. Set the environment variable. Open My Computer > Properties > Advanced > Environment variable, new system variable maven_home, set variable value to Maven installation directory: C:\Maven-3.0. Select the environment variable named "path" in the system variable, double-click the variable, add the absolute path of the bin directory in the Maven installation path to the value of the path variable, and separate the Half-width semicolon from the existing path: C:\Maven-3.0\bin. When the configuration is complete, enter MVN-V in the Windows DOS window to verify that the Maven installation is successful or not, and that if the installation succeeds, the results will display the installation information, such as version number, as shown in Figure 1.

Figure 1. Installation Information

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.