插件的目标(Plugin Goals)
一个插件通常可以完成多个任务,每一个任务就叫做插件的一个目标。如执行mvn install命令时,调用的插件和执行的插件目标如下:
1 [INFO] 插件 插件目标2 [INFO] >>> maven-source-plugin:2.4:jar (attach-sources) @ common-pom >>>3 [INFO]4 [INFO] <<< maven-source-plugin:2.4:jar (attach-sources) @ common-pom <<<5 [INFO]6 [INFO] --- maven-source-plugin:2.4:jar (attach-sources) @ common-pom ---7 [INFO]8 [INFO] --- maven-install-plugin:2.5.1:install (default-install) @ common-pom ---
下面我们就来学习maven强大的插件:源码插件Source Xref
在pom.xml文件中加入下面代码:
12 3 124 11org.apache.maven.plugins 5maven-site-plugin 63.3 78 10zh_CN 9
12 3 134 12org.apache.maven.plugins 5maven-jxr-plugin 62.3 78 11true 9UTF-8 10
执行 mvn site命令,target目录下生成xref项目源码,在网页站点上随时查看项目源码:
1 [INFO] --- maven-site-plugin:3.3:site (default-site) @ common-deploy ---2 [INFO] configuring report plugin org.apache.maven.plugins:maven-jxr-plugin:2.3