Maven by Example 1.4. Universal Reuse through Maven Plugins
2014-12-22 09:41
330 查看
Plugins are more than just a trick to minimize the download size of the Maven distribution.(插件不只只是减少要下载的maven安装包的大小的诡计) Plugins add new behavior to your project’s build.Maven retrieves both dependencies and plugins from the remote repository allowing for
universal reuse of build logic.
The Maven Surefire plugin is the plugin that is responsible for running unit tests. Somewhere between version 1.0 and the version that is in wide use today someone decided to add support for the TestNG unit testing framework in addition to the support for
JUnit. This upgrade happened in a way that didn’t break backwards compatibility. If you were using the Surefire plugin to compile and execute JUnit 3 unit tests, and you upgraded to the most recent version of the Surefire plugin, your tests continued to execute
without fail. But, you gained new functionality, if you want to execute unit tests in TestNG you now have that ability. You also gained the ability to run annotated JUnit 4 unit tests. You gained all of these capabilities without having to upgrade your Maven
installation or install new software. Most importantly, nothing about your project had to change aside from a version number for a plugin a single Maven configuration file called the Project Object Model (POM).
It is this mechanism that affects much more than the Surefire plugin. Maven has plugins for everything from compiling Java code, to generating reports, to deploying to an application server. Maven has abstracted common build tasks into plugins which are
maintained centrally and shared universally. If the state-of-the-art changes in any area of the build, if some new unit testing framework is released or if some new tool is made available, you don’t have to be the one to hack your project’s custom build system
to support it. You benefit from the fact that plugins are downloaded from a remote repository and maintained centrally. This is what is meant by universal reuse through Maven plugins.
universal reuse of build logic.
The Maven Surefire plugin is the plugin that is responsible for running unit tests. Somewhere between version 1.0 and the version that is in wide use today someone decided to add support for the TestNG unit testing framework in addition to the support for
JUnit. This upgrade happened in a way that didn’t break backwards compatibility. If you were using the Surefire plugin to compile and execute JUnit 3 unit tests, and you upgraded to the most recent version of the Surefire plugin, your tests continued to execute
without fail. But, you gained new functionality, if you want to execute unit tests in TestNG you now have that ability. You also gained the ability to run annotated JUnit 4 unit tests. You gained all of these capabilities without having to upgrade your Maven
installation or install new software. Most importantly, nothing about your project had to change aside from a version number for a plugin a single Maven configuration file called the Project Object Model (POM).
It is this mechanism that affects much more than the Surefire plugin. Maven has plugins for everything from compiling Java code, to generating reports, to deploying to an application server. Maven has abstracted common build tasks into plugins which are
maintained centrally and shared universally. If the state-of-the-art changes in any area of the build, if some new unit testing framework is released or if some new tool is made available, you don’t have to be the one to hack your project’s custom build system
to support it. You benefit from the fact that plugins are downloaded from a remote repository and maintained centrally. This is what is meant by universal reuse through Maven plugins.
相关文章推荐
- Maven by Example
- Maven by Example 1.1. Maven… What is it?
- Maven by Example 3.5. Core Concepts
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-antrun-plugi
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-plugin-plugi
- Maven by Example 1.2. Convention Over Configuration
- Maven install 报错: Failed to execute goalorg.apache.maven.plugins:maven-gpg-plugin:1.4:sign (sign-art
- Maven install 报错: Failed to execute goalorg.apache.maven.plugins:maven-gpg-plugin:1.4:sign (sign-art
- Maven by Example 1.3. A Common Interface
- eclipse提示Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-com
- Maven by Example 1.7. Comparing Maven with Ant
- Maven by Example 3.1. Introduction
- maven 问题 Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-res
- Maven by Example Chapter 2. Installing Maven
- Maven install 报错: Failed to execute goalorg.apache.maven.plugins:maven-gpg-plugin:1.4:sign (sign-art
- Maven by Example 2.1. Verify your Java Installation
- Maven by Example 2.2. Downloading Maven
- cocos2d-x by Example Beginner's Guide 第5章 Rocket Through 之 粒子系统
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plu
- Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile 解决办法