防止中文乱码问题
<properties> <!-- 文件拷贝时的编码 --> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <!-- 编译时的编码 --> <maven.compiler.encoding>UTF-8</maven.compiler.encoding> </properties>插件功能:可以通过maven运行testng的案例
<properties> //在 已存在的properties中添加下列代码 <aspectj.version>1.9.2</aspectj.version> </properties> <build> <plugins> <plugin> <!-- maven-surefire-plugin 配合testng/junit执行测试用例的maven插件 --> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.22.1</version> <configuration> <!-- 测试失败后,是否忽略并继续测试 --> <testFailureIgnore>true</testFailureIgnore> <suiteXmlFiles> <!-- testng配置文件名称 --> <suiteXmlFile>testng.xml</suiteXmlFile> </suiteXmlFiles> <!--设置参数命令行 --> <argLine> <!-- UTF-8编码 --> -Dfile.encoding=UTF-8 <!-- 配置拦截器 --> -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar" </argLine> <systemProperties> <property> <!-- 配置 allure 结果存储路径 --> <name>allure.results.directory</name> <value>${project.build.directory}/allure-results</value> </property> </systemProperties> </configuration> <dependencies> <!-- aspectjweaver maven坐标 --> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjweaver</artifactId> <version>${aspectj.version}</version> </dependency> </dependencies> </plugin> </plugins> </build>前提:下载了allure插件,因为要用allure命令;还要配置好环境变量(配置allure的bin目录)。 因为11.4方式不用这2个前提更方便,就没亲自试这个方式。
//cmd控制台进入 allure serve allure-results[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?参考文章解决:点击这里
按上述文章解析,检查自己maven的\apache-maven-3.6.1\conf\settings.xml里的jdk设置成和自己一致的jdk即可, 但过了两天,发现又出现这个问题,so。。。还是没搞定,哎呦。。有时间再研究看看吧