例子如下:
1、maven-clean-plugin插件
执行mvn clean或mvn clean:clean来调用这个插件清理项目。
注意下面日志:Deleting D:\selfProjects\common-project-spring-boot\common-project-job\target
[INFO] Scanning for projects... [INFO] [INFO] -------------< com.smy.common.project:common-project-job >-------------- [INFO] Building common-project-job 1.0-SNAPSHOT [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ common-project-job --- [INFO] Deleting D:\selfProjects\common-project-spring-boot\common-project-job\target [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.580 s [INFO] Finished at: 2023-02-25T23:21:49+08:00 [INFO] ------------------------------------------------------------------------
2、maven-resources-plugin
执行mvn resources:resources来调用这个插件。
注意下面代码:Copying 1 resource
[INFO] Scanning for projects... [INFO] [INFO] -------------< com.smy.common.project:common-project-job >-------------- [INFO] Building common-project-job 1.0-SNAPSHOT [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-resources-plugin:3.2.0:resources (default-cli) @ common-project-job --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Using 'UTF-8' encoding to copy filtered properties files. [INFO] Copying 1 resource [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.028 s [INFO] Finished at: 2023-02-25T23:25:52+08:00 [INFO] ------------------------------------------------------------------------
3、maven-compiler-plugin
执行mvn complie命令会将 src/main/resources 下的资源文件复制到编译输出目录下;接着会将 src/main/java 目录下源代码编译输出到编译输出目录下。编译输出目录默认是 target/classes 目录。
[INFO] Scanning for projects... [INFO] [INFO] -------------< com.smy.common.project:common-project-job >-------------- [INFO] Building common-project-job 1.0-SNAPSHOT [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ common-project-job --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Using 'UTF-8' encoding to copy filtered properties files. [INFO] Copying 1 resource [INFO] [INFO] --- maven-compiler-plugin:3.9.0:compile (default-compile) @ common-project-job --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 3 source files to D:\selfProjects\common-project-spring-boot\common-project-job\target\classes [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 4.124 s [INFO] Finished at: 2023-02-25T23:32:10+08:00 [INFO] ------------------------------------------------------------------------
4、maven-surefire-plugin
执行mvn clean命令执行插件用来在maven构建生命周期的test phase执行一个应用的单元测试。它会产生两种不同形式的测试结果报告:纯文本 或者xml文件格式
5、maven-jar-plugin
打包(jar)插件,设定 MAINFEST .MF文件的参数,比如指定运行的Main class、将依赖的jar包加入classpath中等等,首先我们明确一点的是maven 插件功能:compile、package、deploy...都是在${project.build.directory }/classes 文件路径下面。6、maven-install-plugin
执行mvn install打包到本地仓库
7、maven-deploy-plugin
执行mvn deploy发布到远程
8、maven-site-plugin
生成的测试报告转换为html格式,方便查看。
<build> <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) --> <plugins> <!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle --> <plugin> <artifactId>maven-clean-plugin</artifactId> <version>3.1.0</version> </plugin> <!--资源相关--> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <version>3.2.0</version> <configuration> <overwrite>true</overwrite> <encoding>UTF-8</encoding> </configuration> </plugin> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.9.0</version> </plugin> <plugin> <artifactId>maven-surefire-plugin</artifactId> <version>2.22.1</version> </plugin> <plugin> <artifactId>maven-jar-plugin</artifactId> <version>3.0.2</version> </plugin> <plugin> <artifactId>maven-install-plugin</artifactId> <version>2.5.2</version> </plugin> <plugin> <artifactId>maven-deploy-plugin</artifactId> <version>2.8.2</version> </plugin> <!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle --> <plugin> <artifactId>maven-site-plugin</artifactId> <version>3.7.1</version> </plugin> <plugin> <artifactId>maven-project-info-reports-plugin</artifactId> <version>3.0.0</version> </plugin> </plugins> </pluginManagement> </build>
标签:INFO,project,plugin,配置,maven,job,common From: https://www.cnblogs.com/use-D/p/17155744.html