1、整个打包过程就是插件添加过程,添加build插件
2、指定testng.xml路径的编译插件:执行mvn clean package
<build>
<finalName>test</finalName>
<plugins>
<!--编译打包配置-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.7.1</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>
<!--配置testng.xml路径-->
./src/main/resources/testng.xml
</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
3、springboot项目编译打包,包括对应pom依赖
<!--springboot项目编译打包-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<!--指定应用程序入口-->
<mainClass>extentreport.TestMethodsDemo</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
<compilerArguments>
<extdirs>${project.basedir}</extdirs>
</compilerArguments>
</configuration>
</plugin>