zoukankan      html  css  js  c++  java
  • testng+maven一些坑

    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

  • 相关阅读:
    【NXOpen.UF扩展】修改表达式
    NX二次开发 克隆
    C++手动加载CLR运行托管程序(CLR Hosting)
    C++/CLR 使用(VS2012,VS2013,VS2015)编写
    解决VS2015安装后stdio.h ucrtd.lib等文件无法识别问题,即include+lib环境变量配置
    NX 图标
    【错误分析】NX error status: 32
    NX CAM 读取加工参数
    CAM 模板样式表
    锁定NX原生界面 & 锁定界面更新
  • 原文地址:https://www.cnblogs.com/zhizhiyin/p/9002431.html
Copyright © 2011-2022 走看看