Maven 生命周期和构建原理

       maven是一个非常经典的和通用的项目管理工具,虽然现在热炒gradle将作为下一代 项目管理工具来取代maven,但是 由于maven强大和健全的功能,maven还有很强的生命力。

      本文将介绍maven对于项目生命周期的设计以及原理。

读完本文,你将了解到:

一、maven对项目生命周期的抽象--三大项目生命周期

二、maven对项目默认生命周期的抽象

三、maven指令与生命周期阶段的关系

四、maven生命周期各个阶段的行为与maven默认行为

五、maven项目的目录结构

六、maven为生命周期阶段绑定特定行为动作的机制即插件原理

一、 maven对项目生命周期的抽象--三大项目生命周期


maven从项目的三个不同的角度,定义了单套生命周期,三套生命周期是相互独立的,它们之间不会相互影响。

默认构建生命周期(Default Lifeclyle): 该生命周期表示这项目的构建过程,定义了一个项目的构建要经过的不同的阶段。

清理生命周期(Clean Lifecycle): 该生命周期负责清理项目中的多余信息,保持项目资源和代码的整洁性。一般拿来清空directory(即一般的target)目录下的文件。

站点管理生命周期(Site Lifecycle) :向我们创建一个项目时,我们有时候需要提供一个站点,来介绍这个项目的信息,如项目介绍,项目进度状态、项目组成成员,版本控制信息,项目javadoc索引信息等等。站点管理生命周期定义了站点管理过程的各个阶段。


             本文只介绍maven项目默认的生命周期,其他两个生命周期将另起博文介绍。

二、 maven对项目默认生命周期的抽象





如何查看maven对默认生命周期的定义?

    maven将其架构和结构的组织放置到了components.xml 配置文件中,该配置文件的路径是:

           apache-maven-${version}\lib\maven-core-${version}.jar\META-INFO\plexus\conponents.xml文件中。其中,我们可以看到关于default生命周期XML节点配置信息:


   
   
  1. <component>
  2. <role>org.apache.maven.lifecycle.Lifecycle </role>
  3. <implementation>org.apache.maven.lifecycle.Lifecycle </implementation>
  4. <role-hint>default </role-hint>
  5. <configuration>
  6. <id>default </id>
  7. <phases>
  8. <phase>validate </phase>
  9. <phase>initialize </phase>
  10. <phase>generate-sources </phase>
  11. <phase>process-sources </phase>
  12. <phase>generate-resources </phase>
  13. <phase>process-resources </phase>
  14. <phase>compile </phase>
  15. <phase>process-classes </phase>
  16. <phase>generate-test-sources </phase>
  17. <phase>process-test-sources </phase>
  18. <phase>generate-test-resources </phase>
  19. <phase>process-test-resources </phase>
  20. <phase>test-compile </phase>
  21. <phase>process-test-classes </phase>
  22. <phase>test </phase>
  23. <phase>prepare-package </phase>
  24. <phase>package </phase>
  25. <phase>pre-integration-test </phase>
  26. <phase>integration-test </phase>
  27. <phase>post-integration-test </phase>
  28. <phase>verify </phase>
  29. <phase>install </phase>
  30. <phase>deploy </phase>
  31. </phases>
  32. </configuration>
  33. </component>


maven根据一个项目的生命周期的每个阶段,将一个项目的生命周期抽象成了如上图所示的23个阶段。而每一个阶段应该干什么事情由用户决定。换句话说,maven为每一个阶段设计了接口,你可以为每一阶段自己定义一个接口,进而实现对应阶段应该有的行为。关于如何为某个生命周期阶段绑定自定义的行为,我将在后面的章节介绍。


三、 maven指令与生命周期阶段的关系





四、maven生命周期各个阶段的行为与maven默认行为

使用过maven的读者会经常使用这些maven指令:

  
  
  1. mvn compile //让当前项目经历生命周期中的1-->7 阶段 :完成编译主源代码编译
  2. mvn package //让当前项目经历生命周期中的1-->17阶段 :完成打包
  3. mvn install //让当前项目经历生命周期中的1-->22阶段 :完成包安装到本地仓库
  4. mvn deploy //让当前生命经历生命周期中的1-->23阶段 :完成包部署到中心库中

在经历这些生命周期的阶段中,每个阶段会理论上会有相应的处理操作。但是,在实际的项目开发过程中, 并不是所有的生命周期阶段都是必须的。
然而,在实际的开发过程中,往往我们的项目的一些生命周期的阶段不需要相应的行为,我们只需要关心其中某些重要的生命周期阶段而已。下面,请看一下日常开发中,我们需要关注的生命周期阶段,即广大开发人员对项目周期阶段处理的约定:
1).应该将resource资源文件准备好,放到指定的target目录下----process-resources 阶段;
2).将java源文件编译成.class文件,然后将class 文件放置到对应的target目录下----compile阶段;
3).将test类型的resource移动到指定的 target目录下------process-test-resource阶段;
4).将test类型的java 源文件编译成class文件,然后放置到指定的target目录下------test-compile阶段;
5).运行test测试用例-------test阶段;
6).将compile阶段编译的class文件和resource资源打包成jar包或war包--------package阶段;
7).将生成的包安装到本地仓库中------install阶段
8).将生成的包部署到远程仓库中-----deploy阶段

           由上面的约定可以看出,在大多数情况下,大家关心的项目生命周期阶段仅仅是上面的8个而已。跟上面maven对生命周期阶段23个的抽象相比,这就少的很多了。

        基于类似的约定,maven默认地为一些不同类型的maven项目生命周期的阶段实现了默认的行为。

        maven 在设计上将生命周期阶段的抽象对应阶段应该执行的行为实现分离开,maven这些实现放到了插件中,这些插件本质上是实现了maven留在各个生命周期阶段的接口。关于插件的问题,我将另外写一篇博文介绍。

如下图所示,maven针对不同打包类型的maven项目的生命周期阶段绑定了对应的默认行为:

如上图所示,对于不同的打包格式的项目而言,maven为特定类型的包格式项目在不同的生命周期阶段的默认行为。

而对于我们经常使用的jar和war包格式的项目而言,maven总共为其规定了以下几个生命周期阶段的默认行为:





五、 maven项目的目录结构

well,每个项目工程,都有非常繁琐的目录结构,每个目录都有不同的作用。请记住这一点,目录的划分是根据需要来的,每个目录有其特定的功能。目录本质上就是一个文件或文件夹路径而已。那么,我们换一个思路考虑:一个项目的文件结构需要组织什么信息呢?让我们来看一下功能的划分:


如上图所示,你会看到maven项目里不同功能类型的目录定义以及maven默认的目录的路径。

如何修改默认的目录配置

在maven项目工程对应project的 pom.xml中,在<project>--><build>节点下,你可以指定自己的目录路径信息:


  
  
  1. <build>
  2. <!-- 目录信息维护,用户可以指定自己的目录路径 -->
  3. <sourceDirectory>E:\intellis\maven-principle\phase-echo\src\main\java </sourceDirectory>
  4. <scriptSourceDirectory>E:\intellis\maven-principle\phase-echo\src\main\scripts </scriptSourceDirectory>
  5. <testSourceDirectory>E:\intellis\maven-principle\phase-echo\src\test\java </testSourceDirectory>
  6. <outputDirectory>E:\intellis\maven-principle\phase-echo\target\classes </outputDirectory>
  7. <testOutputDirectory>E:\intellis\maven-principle\phase-echo\target\test-classes </testOutputDirectory>
  8. <!-- 注意,对resource而言,可以有很多个resource路径的配置,你只需要指定对应的路径是resource即可 -->
  9. <resources>
  10. <resource>
  11. <directory>E:\intellis\maven-principle\phase-echo\src\main\resources </directory>
  12. </resource>
  13. </resources>
  14. <!-- 注意,对resource而言,可以有很多个resource路径的配置,你只需要指定对应的路径是resource即可 -->
  15. <testResources>
  16. <testResource>
  17. <directory>E:\intellis\maven-principle\phase-echo\src\test\resources </directory>
  18. </testResource>
  19. </testResources>
  20. <directory>E:\intellis\maven-principle\phase-echo\target </directory>
  21. </build>

请注意:对于maven管理项目工程的生命周期的操作上, 都发生在上述的几种目录中。换句话说,实质上,maven的项目管理的整个过程,就是围绕着对上述几种文件目录中内容的操作。


六、maven为生命周期阶段绑定特定行为动作的机制(即插件原理)


为maven生命周期的某些阶段绑定特定行为或动作,简单点就是调用一段代码而已,maven将需要执行的逻辑抽象成了一个接口,接口为 Mojo。Mojo是 Maven Old plain Java Object的简写,表示的意思是Mojo是maven的一个简单的对象。如下图所示:


maven通过为某一个项目的生命周期阶段绑定若干个Mojo,然后依次执行Mojo.execute()方法,从而实现特定生命周期应该执行的动作。

举例:比如,对于生命周期阶段process-resources,maven默认地为其绑定了一个Mojo:  org.apache.maven.plugin.resources.ResourcesMojo。

当需要经历process-resources阶段时,maven将会创建一个ResourcesMojo 实例instance,然后调用instance.execute()方法。


  
  
  1. @Mojo( name = "resources", defaultPhase = LifecyclePhase.PROCESS_RESOURCES, threadSafe = true )
  2. public class ResourcesMojo
  3. extends AbstractMojo
  4. implements Contextualizable
  5. {
  6. /**
  7. 下面若干个attribute ,maven 读取pom.xml内的配置信息,这里的attribute对应着pom.xml里的配置,如果在这里声明了,maven在创建Mojo 实例
  8. instance的时候,会将这些值注入到instance内,供Mojo instance使用
  9. */
  10.   /**
  11. * The character encoding scheme to be applied when filtering resources.
  12. */
  13. @Parameter( property = "encoding", defaultValue = "${project.build.sourceEncoding}" )
  14. protected String encoding;
  15. /**
  16. * The output directory into which to copy the resources.
  17. */
  18. @Parameter( defaultValue = "${project.build.outputDirectory}", required = true )
  19. private File outputDirectory;
  20. /**
  21. * The list of resources we want to transfer.
  22. */
  23. @Parameter( defaultValue = "${project.resources}", required = true, readonly = true )
  24. private List<Resource> resources;
  25. /**
  26. *
  27. */
  28. @Parameter( defaultValue = "${project}", required = true, readonly = true )
  29. protected MavenProject project;
  30. /**
  31. * The list of additional filter properties files to be used along with System and project
  32. * properties, which would be used for the filtering.
  33. * <br/>
  34. * See also: {@link ResourcesMojo#filters}.
  35. *
  36. * @since 2.4
  37. */
  38. @Parameter( defaultValue = "${project.build.filters}", readonly = true )
  39. protected List<String> buildFilters;
  40. /**
  41. * The list of extra filter properties files to be used along with System properties,
  42. * project properties, and filter properties files specified in the POM build/filters section,
  43. * which should be used for the filtering during the current mojo execution.
  44. * <br/>
  45. * Normally, these will be configured from a plugin's execution section, to provide a different
  46. * set of filters for a particular execution. For instance, starting in Maven 2.2.0, you have the
  47. * option of configuring executions with the id's <code>default-resources</code> and
  48. * <code>default-testResources</code> to supply different configurations for the two
  49. * different types of resources. By supplying <code>extraFilters</code> configurations, you
  50. * can separate which filters are used for which type of resource.
  51. */
  52. @Parameter
  53. protected List<String> filters;
  54. /**
  55. * If false, don't use the filters specified in the build/filters section of the POM when
  56. * processing resources in this mojo execution.
  57. * <br/>
  58. * See also: {@link ResourcesMojo#buildFilters} and {@link ResourcesMojo#filters}
  59. *
  60. * @since 2.4
  61. */
  62. @Parameter( defaultValue = "true" )
  63. protected boolean useBuildFilters;
  64. /**
  65. *
  66. */
  67. @Component( role = MavenResourcesFiltering.class, hint = "default" )
  68. protected MavenResourcesFiltering mavenResourcesFiltering;
  69. /**
  70. *
  71. */
  72. @Parameter( defaultValue = "${session}", required = true, readonly = true )
  73. protected MavenSession session;
  74. /**
  75. * Expression preceded with the String won't be interpolated
  76. * \${foo} will be replaced with ${foo}
  77. *
  78. * @since 2.3
  79. */
  80. @Parameter( property = "maven.resources.escapeString" )
  81. protected String escapeString;
  82. /**
  83. * Overwrite existing files even if the destination files are newer.
  84. *
  85. * @since 2.3
  86. */
  87. @Parameter( property = "maven.resources.overwrite", defaultValue = "false" )
  88. private boolean overwrite;
  89. /**
  90. * Copy any empty directories included in the Resources.
  91. *
  92. * @since 2.3
  93. */
  94. @Parameter( property = "maven.resources.includeEmptyDirs", defaultValue = "false" )
  95. protected boolean includeEmptyDirs;
  96. /**
  97. * Additional file extensions to not apply filtering (already defined are : jpg, jpeg, gif, bmp, png)
  98. *
  99. * @since 2.3
  100. */
  101. @Parameter
  102. protected List<String> nonFilteredFileExtensions;
  103. /**
  104. * Whether to escape backslashes and colons in windows-style paths.
  105. *
  106. * @since 2.4
  107. */
  108. @Parameter( property = "maven.resources.escapeWindowsPaths", defaultValue = "true" )
  109. protected boolean escapeWindowsPaths;
  110. /**
  111. * <p>
  112. * Set of delimiters for expressions to filter within the resources. These delimiters are specified in the
  113. * form 'beginToken*endToken'. If no '*' is given, the delimiter is assumed to be the same for start and end.
  114. * </p><p>
  115. * So, the default filtering delimiters might be specified as:
  116. * </p>
  117. * <pre>
  118. * <delimiters>
  119. * <delimiter>${*}</delimiter>
  120. * <delimiter>@</delimiter>
  121. * </delimiters>
  122. * </pre>
  123. * <p>
  124. * Since the '@' delimiter is the same on both ends, we don't need to specify '@*@' (though we can).
  125. * </p>
  126. *
  127. * @since 2.4
  128. */
  129. @Parameter
  130. protected List<String> delimiters;
  131. /**
  132. * @since 2.4
  133. */
  134. @Parameter( defaultValue = "true" )
  135. protected boolean useDefaultDelimiters;
  136. /**
  137. * <p>
  138. * List of plexus components hint which implements {@link MavenResourcesFiltering#filterResources(MavenResourcesExecution)}.
  139. * They will be executed after the resources copying/filtering.
  140. * </p>
  141. *
  142. * @since 2.4
  143. */
  144. @Parameter
  145. private List<String> mavenFilteringHints;
  146. /**
  147. * @since 2.4
  148. */
  149. private PlexusContainer plexusContainer;
  150. /**
  151. * @since 2.4
  152. */
  153. private List<MavenResourcesFiltering> mavenFilteringComponents = new ArrayList<MavenResourcesFiltering>();
  154. /**
  155. * stop searching endToken at the end of line
  156. *
  157. * @since 2.5
  158. */
  159. @Parameter( property = "maven.resources.supportMultiLineFiltering", defaultValue = "false" )
  160. private boolean supportMultiLineFiltering;
  161. public void contextualize( Context context )
  162. throws ContextException
  163. {
  164. plexusContainer = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
  165. }
  166. public void execute()
  167. throws MojoExecutionException
  168. {
  169. try
  170. {
  171. if ( StringUtils.isEmpty( encoding ) && isFilteringEnabled( getResources() ) )
  172. {
  173. getLog().warn( "File encoding has not been set, using platform encoding " + ReaderFactory.FILE_ENCODING
  174. + ", i.e. build is platform dependent!" );
  175. }
  176. //获取资源文件过滤器配置
  177. List filters = getCombinedFiltersList();
  178. //根据现有配置信息创建Resources处理器对象实例
  179. MavenResourcesExecution mavenResourcesExecution =
  180. new MavenResourcesExecution( getResources(), getOutputDirectory(), project, encoding, filters,
  181. Collections.<String>emptyList(), session );
  182. //windows路径处理
  183. mavenResourcesExecution.setEscapeWindowsPaths( escapeWindowsPaths );
  184. // never include project build filters in this call, since we've already accounted for the POM build filters
  185. // above, in getCombinedFiltersList().
  186. mavenResourcesExecution.setInjectProjectBuildFilters( false );
  187. mavenResourcesExecution.setEscapeString( escapeString );
  188. mavenResourcesExecution.setOverwrite( overwrite );
  189. mavenResourcesExecution.setIncludeEmptyDirs( includeEmptyDirs );
  190. mavenResourcesExecution.setSupportMultiLineFiltering( supportMultiLineFiltering );
  191. // if these are NOT set, just use the defaults, which are '${*}' and '@'.
  192. if ( delimiters != null && !delimiters.isEmpty() )
  193. {
  194. LinkedHashSet<String> delims = new LinkedHashSet<String>();
  195. if ( useDefaultDelimiters )
  196. {
  197. delims.addAll( mavenResourcesExecution.getDelimiters() );
  198. }
  199. for ( String delim : delimiters )
  200. {
  201. if ( delim == null )
  202. {
  203. // FIXME: ${filter:*} could also trigger this condition. Need a better long-term solution.
  204. delims.add( "${*}" );
  205. }
  206. else
  207. {
  208. delims.add( delim );
  209. }
  210. }
  211. mavenResourcesExecution.setDelimiters( delims );
  212. }
  213. if ( nonFilteredFileExtensions != null )
  214. {
  215. mavenResourcesExecution.setNonFilteredFileExtensions( nonFilteredFileExtensions );
  216. }
  217. mavenResourcesFiltering.filterResources( mavenResourcesExecution );
  218. //执行Resource文件拷贝
  219. executeUserFilterComponents( mavenResourcesExecution );
  220. }
  221. catch ( MavenFilteringException e )
  222. {
  223. throw new MojoExecutionException( e.getMessage(), e );
  224. }
  225. }
  226. /**
  227. * @since 2.5
  228. */
  229. protected void executeUserFilterComponents( MavenResourcesExecution mavenResourcesExecution )
  230. throws MojoExecutionException, MavenFilteringException
  231. {
  232. if ( mavenFilteringHints != null )
  233. {
  234. for ( Iterator ite = mavenFilteringHints.iterator(); ite.hasNext(); )
  235. {
  236. String hint = (String) ite.next();
  237. try
  238. {
  239. mavenFilteringComponents.add(
  240. (MavenResourcesFiltering) plexusContainer.lookup( MavenResourcesFiltering.class.getName(),
  241. hint ) );
  242. }
  243. catch ( ComponentLookupException e )
  244. {
  245. throw new MojoExecutionException( e.getMessage(), e );
  246. }
  247. }
  248. }
  249. else
  250. {
  251. getLog().debug( "no use filter components" );
  252. }
  253. if ( mavenFilteringComponents != null && !mavenFilteringComponents.isEmpty() )
  254. {
  255. getLog().debug( "execute user filters" );
  256. for ( MavenResourcesFiltering filter : mavenFilteringComponents )
  257. {
  258. filter.filterResources( mavenResourcesExecution );
  259. }
  260. }
  261. }
  262. protected List<String> getCombinedFiltersList()
  263. {
  264. if ( filters == null || filters.isEmpty() )
  265. {
  266. return useBuildFilters ? buildFilters : null;
  267. }
  268. else
  269. {
  270. List<String> result = new ArrayList<String>();
  271. if ( useBuildFilters && buildFilters != null && !buildFilters.isEmpty() )
  272. {
  273. result.addAll( buildFilters );
  274. }
  275. result.addAll( filters );
  276. return result;
  277. }
  278. }
  279. /**
  280. * Determines whether filtering has been enabled for any resource.
  281. *
  282. * @param resources The set of resources to check for filtering, may be <code>null</code>.
  283. * @return <code>true</code> if at least one resource uses filtering, <code>false</code> otherwise.
  284. */
  285. private boolean isFilteringEnabled( Collection<Resource> resources )
  286. {
  287. if ( resources != null )
  288. {
  289. for ( Resource resource : resources )
  290. {
  291. if ( resource.isFiltering() )
  292. {
  293. return true;
  294. }
  295. }
  296. }
  297. return false;
  298. }
  299. }

上面只是介绍了Maven生命周期阶段绑定执行代码的基本模式,由于maven的生命周期众多,并且每个生命周期内有可能绑定多个Mojo,如果使用上述的模式简单关联的话,会显得结构组织很乱。

maven会根据Mojo功能的划分,将具有相似功能的Mojo放到一个插件中。并且某一个特定的Mojo能实现的功能称为 goal,即目标,表明该Mojo能实现什么目标。


例如,我们项目生命周期有两个阶段:compile 和 test-compile,这两阶段都是需要将java源代码编译成class文件中,相对应地,compile和test-compiler分别被绑定到了org.apache.maven.plugin.compiler.CompilerMojo 和org.apache.maven.plugin.compiler.TestCompilerMojo上:

如何查看maven各个生命周期阶段和插件的绑定情况

maven默认实现上,会为各个常用的生命周期根据约定绑定特定的插件目标。maven将这些配置放置到了:

apache-maven-${version}\lib\maven-core-${version}.jar\META-INFO\plexus\default-binds.xml文件中,针对不同打包类型的项目,其默认绑定情况也会不一样,我们先看一下常用的jar包类型和war包类型的项目默认绑定情况:



  
  
  1. <!-- jar包格式的项目生命周期各个阶段默认绑定情况 -->
  2. <component>
  3. <role>org.apache.maven.lifecycle.mapping.LifecycleMapping </role>
  4. <role-hint>jar </role-hint>
  5. <implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping </implementation>
  6. <configuration>
  7. <lifecycles>
  8. <lifecycle>
  9. <id>default </id>
  10. <!-- START SNIPPET: jar-lifecycle -->
  11. <phases>
  12. <!-- 插件绑定的格式: <plugin-groupid>:<plugin-artifactid>:<version>:goal -->
  13. <process-resources>
  14. org.apache.maven.plugins:maven-resources-plugin:2.6:resources
  15. </process-resources>
  16. <compile>
  17. org.apache.maven.plugins:maven-compiler-plugin:3.1:compile
  18. </compile>
  19. <process-test-resources>
  20. org.apache.maven.plugins:maven-resources-plugin:2.6:testResources
  21. </process-test-resources>
  22. <test-compile>
  23. org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile
  24. </test-compile>
  25. <test>
  26. org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test
  27. </test>
  28. <package>
  29. org.apache.maven.plugins:maven-jar-plugin:2.4:jar
  30. </package>
  31. <install>
  32. org.apache.maven.plugins:maven-install-plugin:2.4:install
  33. </install>
  34. <deploy>
  35. org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy
  36. </deploy>
  37. </phases>
  38. <!-- END SNIPPET: jar-lifecycle -->
  39. </lifecycle>
  40. </lifecycles>
  41. </configuration>
  42. </component>
  43. <!-- war包格式的项目生命周期各个阶段默认绑定情况 -->
  44. <component>
  45. <role>org.apache.maven.lifecycle.mapping.LifecycleMapping </role>
  46. <role-hint>war </role-hint>
  47. <implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping </implementation>
  48. <configuration>
  49. <lifecycles>
  50. <lifecycle>
  51. <id>default </id>
  52. <!-- START SNIPPET: war-lifecycle -->
  53. <phases>
  54. <process-resources>
  55. org.apache.maven.plugins:maven-resources-plugin:2.6:resources
  56. </process-resources>
  57. <compile>
  58. org.apache.maven.plugins:maven-compiler-plugin:3.1:compile
  59. </compile>
  60. <process-test-resources>
  61. org.apache.maven.plugins:maven-resources-plugin:2.6:testResources
  62. </process-test-resources>
  63. <test-compile>
  64. org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile
  65. </test-compile>
  66. <test>
  67. org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test
  68. </test>
  69. <package>
  70. org.apache.maven.plugins:maven-war-plugin:2.2:war
  71. </package>
  72. <install>
  73. org.apache.maven.plugins:maven-install-plugin:2.4:install
  74. </install>
  75. <deploy>
  76. org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy
  77. </deploy>
  78. </phases>
  79. <!-- END SNIPPET: war-lifecycle -->
  80. </lifecycle>
  81. </lifecycles>
  82. </configuration>
  83. </component>

如果你想查看当前maven有多少插件,每个插件都干了什么,你可以访问 maven plugin主页了解 : http://maven.apache.org/plugins/index.html




写在最后

本文旨在向读者介绍maven默认生命周期的工作机制,以及maven在项目构建过程中的基本原理和机制。

本文介绍的比较宽泛,还没有深入到maven插件底层,随后一篇博文将会详细介绍插件,解析插件的工作原理,分析当前maven默认定义的插件,并最终自己定义插件完成特定功能,敬请关注!

由于本人技术有限,如果本人有任何错误和纰漏,请读者慷慨指出,共同学习,共同进步!


2016.1.15














  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值