1.
[TestNGContentHandler] [WARN] It is strongly recommended to add "<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"
>" at the top of your file, otherwise TestNG may fail or not work as expected.
需要在testng.xml中添加一行
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="testproj" parallel="false">
<test name="testDemo1">
<classes>
<class name="com.test.demo.SimpleTest.java"></class>
</classes>
</test>
</suite>
2.
org.testng.TestNGException: Cannot find class in classpath
原因是testng.xml的用例名称后缀加了.java
<class name="com.test.demo.SimpleTest.java"></class>
3.
报错source1.7不能调用lamber表达式
·将maven的settings.xml里面的jdk配置改成1.8的
<profile>
<id>jdk17</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.8</jdk>
</activation>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
<!-- 文件拷贝时的编码 -->
<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>
</profile>
·将eclipse的编码改成jdk1.8的
·将eclipse的maven的pom.xml的build-compiler指定jdk版本
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<compilerArgs>
<arg>-Xlint:unchecked</arg>
<arg>-Xlint:deprecation </arg>
<!--<arg>endorseddirs=${endorsed.dir}</arg>-->
</compilerArgs>
</configuration>
</plugin>
4.
引入了testng的包,但是用着用着就忽然用不了了,红色划线报错。
· clean up工程,再maven-update
·第一条还不行,就删掉testng的repository,重新maven-update(我就是这么解决的)
5.
.jar which is referenced by the classpath, does not exist.
build path 里面,把relate的那些打叉的包全部remove
参考:https://www.cnblogs.com/xwdreamer/archive/2012/01/11/2318656.html