Maven combat (1) what is it?

 

 

1. Maven... What is it? (Project Management Tools, Build Tools, Plugins, Build Sites, Lifecycles)

 

    How you answer this question depends on how you view it. Most Maven users refer to Maven as a "build tool": a tool for building source code into releasable artifacts. Build engineers and project managers will say that Maven is something more complex: a project management tool. So what is the difference? Build tools like Ant simply focus on preprocessing, compiling, packaging, testing and distribution. A project management tool like Maven provides a superset of functionality provided by build tools. In addition to providing build functionality, Maven can generate reports, generate Web sites, and help facilitate communication among work team members.

   A more formal definition of Apache Maven1: Maven is a project management tool that includes a project object model (Project Object Model), a set of standards, a project life cycle (ProjectLifecycle), a dependency management system (Dependency Management System) ), and the logic used to run the plugin goals defined in the lifecycle phases. When you use Maven, you describe your project with a well-defined project object model, and then Maven can apply cross-cutting logic from a set of shared (or custom) plugins.

 

 

2. Convention is better than configuration (annotation is better than configuration)

 

    Maven's use of convention over configuration goes beyond simple directory locations, Maven's core plugins use a common set of conventions for compiling source code, packaging distributable artifacts, generating web sites, and many others Process. Maven's power comes from its "arbitrary", with a defined lifecycle and a set of generic plugins that know how to build and assemble software. If you follow these conventions, Maven requires almost zero work - just get your source code into the correct directory, and Maven will take care of the rest for you.

 

 

3. Learn to use the maven plug-in (plug-in reflects the ability)

    Maven at its core doesn't really do anything practical, it doesn't know anything other than parsing some XML documents, managing lifecycles and plugins. Maven is designed to delegate primary responsibilities to a set of Maven plugins that can affect the Maven lifecycle, providing access to goals.

    Most Maven actions take place in the goals of the Maven plugin, such as compiling source code, packaging binaries, publishing sites, and other build tasks. The Maven you download from Apache doesn't know how to package WAR files or run unit tests. Much of Maven's intelligence is implemented by plugins, which are obtained from Maven repositories. In fact, the first time you run a command such as mvn install with a fresh Maven installation, it will download most of the core Maven plugins from the central Maven repository. This is not just a trick to minimize the size of your Maven distribution, it also allows you to upgrade plugins to give your project's build more power.

 

  For details on how to use common Maven plug-ins, please refer to network resources: http://blog.csdn.net/eg366/article/details/9398681

 

 

4. Maven gives software projects a new model definition

 

    Maven maintains a model of a project, you not only need to compile the source code into bytecode, you also need to develop the description information of the software project, specifying a unique set of coordinates for the project. You want to describe the properties of the item. What is the license for the project? Who develops this project and contributes to this project? What other projects does this project depend on? Maven is not just a "build tool", it is not just an improvement on tools like make and Ant, it is a platform that contains a set of semantic rules about software projects and software development. This per-project-defined model implements the following features:

1. Dependency management

       Since the project is defined in terms of a unique coordinate containing the group identifier, component identifier and version. These coordinates can be used between projects to declare dependencies.

2. Remote warehouse

       Related to project dependencies, we can create a repository of Maven artifacts using coordinates defined in the Project Object Model (POM).

3. Global build logic reuse

       Plugins are written to work with Project Model Objects (POMs), they are not designed to manipulate specific files in a known location. Everything is abstracted into the model, where plugin configuration and custom behaviors take place.

4. Tool portability/integration

      Tools like Eclipse, NetBeans, and InteliJ now have a common place to find project information. Before Maven, every IDE had a different way to store what was actually a custom project object model (POM). Maven standardized this description, and while each IDE still continues to maintain its custom project files, these files can now be easily generated from models.

5. Easy to search and filter widgets

      Tools like Nexus allow you to index and search the content of the repository using the information stored in the POM.

   Maven gives software projects new model definitions

 

 

   

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326437713&siteId=291194637