分类 maven 相关 下的文章

Maven 完全参考 学习笔记 (3) Project Object Model - Project Dependencies

  1. There are 4.5 types of dependence scope. compile(default), test[junit], provided[servlet], runtime[mysql-jdbc], system;
  2. you can define: Optional Dependencies. subproject or depends project will choose dependence;
  3. Version Ranges: (, ), [, ], [3.8,4.0), [,3.8.1], etc;
  4. 传递性依赖 和 冲突解析;
  5. Project relationship: depends, parent-child, project-subModule;
  6. Child POM inherits from its parent POM:

identifiers (at least one of groupId or artifactId must be overridden.)
dependencies
developers and contributors
plugin lists
reports lists
plugin executions (executions with matching ids are merged)
plugin configuration

  1. Maven assumes that the parent POM is available from the local repository, or available in the parent directory (../pom.xml) of the current project. Or you can use relativePath to customize: <relativePath>../a-parent/pom.xml</relativePath>
  2. Best Practices:

Grouping Dependencies
Multi-module vs. Inheritance

Maven 完全参考 学习笔记 (3) Project Object Model - 1

在线书 Project Object Model

  1. POM: things and actions. things in pom.xml and actions in your command and life cyle (phase, goal);
  2. The POM is also not specific to building Java projects;
  3. The POM contains four categories of description and configuration

The Four Categories of POM

  1. The Super POM: All Maven project POMs extend the Super POM, which defines a set of defaults shared by all projects. This Super POM is a part of the Maven installation. it is in in ${M2_HOME}/lib/maven_*.jar;
  2. The Super POM defines some standard configuration variables that are inherited by all projects. Like central repo, plugin repo, folder structures, etc;
  3. The Effective POM: merge between the Super POM and your pom:$ mvn help:effective-pom;
  4. Project version: <major version>.<minor version>.<incremental version>-<qualifier>;
  5. Keeping your version numbers aligned with this standard will become very important when you want to start using version ranges in your POMs. or it will use String comparison;
  6. The qualifier exists to capture milestone builds: alpha and beta releases;
  7. Use "alpha-02" as qualifier, not "alpha-2", when you have "alpha-10";
  8. SNAPSHOT versions are used for projects under active development.
  9. Property References: preceded by a dollar sign and surrounded by two curly braces. ex: ${project.groupId}. could be: env, project, settings;

Maven 完全参考 学习笔记 (1) 简介

online book Maven: The Complete Reference

  1. Maven: A tool more than build;
  2. Maven is a project management tool which encompasses a project object model, a set of standards, a project lifecycle, a dependency management system, and logic for executing plugin goals at defined phases in a lifecycle. When you use Maven, you describe your project using a well-defined project object model, Maven can then apply cross-cutting logic from a set of shared (or custom) plugins.
  3. COC 最佳实践 共同知识 easonable defaults. Not only folders, plugin..., And can .. customized.
  4. The core of Maven is pretty dumb, it doesn’t know how to do much beyond parsing a few XML documents and keeping track of a lifecycle and a few plugins. Maven has been designed to delegate most responsibility to a set of Maven Plugins which can affect the Maven Lifecycle and offer access to goals.