"Maven combat" learning summary (1)-Maven expert

The role of Maven

       Maven is a cross-platform project management tool. Maven has been used in many projects that I participated in. It must be necessary to do a more in-depth study and summary of this weapon! First, let's talk about the role of Maven, which can be divided into the following major aspects:


build: build

        Of course, it is not what we usually call "gou jian". The construction here refers to the daily development, in addition to the work of writing the source code, whether we are unconsciously performing the source code compilation, testing, packaging, deployment and other related operations, although these tasks are not trivial, But it also took a lot of our time. If you are still doing these tasks manually, then you can switch to using Maven's processing method, a simple command can achieve the entire build process. This way greatly improves work efficiency.

        Maven analyzes and sorts out the construction methods of a large number of projects, and summarizes a complete set of construction life cycles. By entering and executing Maven commands, we can use Maven to get the construction results we want. Through abstraction and summary, Maven's project life cycle is applicable to all projects, which means that Maven provides a standard life cycle process for our project construction.


Dependency Management: Dependency Management

       Maybe you also have this experience: Before starting the formal coding of a project, we always have to determine the technology used in the project, which is often accompanied by the introduction of various components into the project (also known as project dependencies ), And because our project needs to rely on many components, it often causes problems such as jar package version errors and conflicts. Using the component coordinate concept introduced by Maven for us and the dependency management mechanism it provides, it is easy to introduce dependencies and quickly locate and solve problems when dependency problems occur


Convention Over Configuration: Convention is better than configuration

       This should be regarded as a principle. It is according to this principle that although we have abandoned some flexibility, it has brought about unity and standards. Through agreement, we can reduce the cost of learning.


Compare

       HERE

              The construction is relatively independent, and it is difficult to unify the configuration

       Procedural

              Make: It may be the earliest build tool (1977), which is bound to the operating system and can use the powerful local commands of the system, so it is difficult to achieve cross-platform. Makefile syntax is very problematic.

              Ant (Another Neat Tool): Java version of Make, cross-platform, first used to build Tomcat, using Ivy to achieve dependency management


       Declarative vs procedural

              Both Make and Ant need to specify goals and tasks that need to be completed. Different projects need to be rewritten, and a lot of repetitive work.

              Maven abstracts the unified construction life cycle, the separation of goals and tasks, different tasks are completed by plug-ins, and Maven provides a default implementation.


Summary of Maven

       This article leads everyone to know Maven, understand the role of Maven is essential for learning Maven, and understand the purpose of learning to have a direction. You may have a deeper experience by studying and practicing later and looking back at the role of Maven.


Published 159 original articles · praised 225 · 210,000 views

Guess you like

Origin blog.csdn.net/lyg673770712/article/details/50768040