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>
