Maven in Action (a) Maven introduction

Source: Internet
Author: User
Tags version control system

after reading "maven combat" this book and some other information about MAVEN construction, it is necessary to summarize several blogs, share to everyone, as soon as possible through a few blogs to learn about the build and other tools for building.

What is maven?

By the way, you will find that Maven has the meaning of "insider" and "expert" and can be translated into "accumulation of knowledge". In line with its original intent, MAVEN abstracts a series of computers that we often manually work with MAVEN tools instead of manually performing these repetitive operations. Professionally, MAVEN is based on the Project object Model POM (Project-object-model), which is more suitable for sub-module development systems, which can manage project building, reporting, and documentation software management tools through a small description of the information.

to put it simply, we used to have a common Web project, when we needed to rely on the package to download the corresponding dependent jar package, we need to manually import into the Lib folder, and build the project with MAVEN, we only need to write the jar package name and version information, MAVEN will automatically download the jar we need on the website. Executing code requires us to compile, run unit tests, generate documents, package, deploy, and MAVEN tools encapsulate these repetitive tasks for us. (If you feel a headache, see here to see the next article.) It's OK to know about it first. )

What is build?

in layman's terms, in addition to writing source code things are built (build), such as we upload from svn source and download source, then compile, run unit tests, and then manually package a war version (may not even version number), and then to the OPS personnel, OPS copy to the container and start the container, which is the build. In addition to writing the source code we have a large part of the time spent on this repetitive work, so someone using the software method to make a series of work completely automated, so that the software is built as a line of automatic pipeline, just need a simple command, all the trivial work automatically completed, and quickly get results.

as a build tool, Maven can not only help us automate builds, but also abstract the build process and provide the implementation of the build task, which can provide a consistent interface across platforms, which is enough to make it a good, popular build tool.

Is maven just a build tool?

maven is also a dependency management tool and project information management tool. It provides a central repository that can help me automatically download widgets.

maven can automatically solve problems such as increased dependency on jars, inconsistent versions of Jars, versioning conflicts, and dependency bloat. MAVEN offers an excellent solution that accurately locates each build (such as a jar) through a coordinate system, and can find any jar with a set of coordinates, easily solving a complex dependency problem.

maven also helps us manage project information that is scattered across the project, including project descriptions, developer lists, version control system addresses, licenses, defect management system addresses, and more.

maven also provides a free central repository for Java developers around the world, and with these tools (Nexus), we can quickly search for them.

Why do I need maven?

just like when you buy a computer you do not need to buy the parts yourself, manually to assemble the computer, to test the hardware, system and driver installation. Some of them have done it properly, saving time and effort.

The IDE is not omnipotent, although a good IDE can greatly improve the development efficiency. However, the IDE relies on a lot of manual operations, compiling, testing, code generation and other work are independent, it is difficult to do all the work with one click. Manual means inefficiency, which means error-prone.

It's hard to unify all of the IDE's configurations in the project, and everyone has their own preferences, so sometimes the same project can run normally on A's PC, while on the B pc it may fail. We should make reasonable use of the IDE, rather than relying too much on it. For a task like this, it is foolish to click the mouse over and over again in the IDE. MAVEN is an expert in this area, and the mainstream IDE integrates MAVEN, and we can run maven in the IDE to perform the build easily.

Maven and agile development? (Beginners can easily understand)

maven can achieve some of the core values of agile development:

Simple

maven has a mature, stable component that simplifies the complexity of building systems.

Communication and feedback

when combined with a version control system, everyone can perform the latest builds and get feedback quickly.

test-driven development

when all products require test case coverage, MAVEN has ready-to-use test frameworks that support maturity, such as JUnit and testng.

10-minute build

This is what Maven is good at, with only a few configurations, and then a simple command that lets maven clean, compile, test, package, deploy, and then get the final product.

Continuous Integration (CI)

CI (continuous integration) is a prerequisite for the long-term integration of the source management system and building systems, the industry's popular CI servers and Jenkins are well integrated with Maven.

Information-rich workspaces

developers can quickly understand project dynamics, use MAVEN's published project reporting site, and configure the project reports you need, such as test case reports, to help you push the information to the developer's eyes.

Ant and maven? (If you don't know ant you can look directly at the next article, this is an extension of the knowledge node, for beginners do not need to see)

1. Ant is procedural, and we have to tell ant exactly what to do and when to do it. Tell him to compile, and then copy the compression.

2. Ant is not a life cycle, you must define the dependencies between goals and targets, and manually attach a task sequence to each target.

and Maven and exactly the opposite, then in use to understand the difference between Maven and Ant, the next Maven installation and configuration.

Maven in Action (a) Maven introduction

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.