Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/310.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Jenkins没有执行Junit测试类(Maven项目)_Java_Maven_Junit - Fatal编程技术网

Java Jenkins没有执行Junit测试类(Maven项目)

Java Jenkins没有执行Junit测试类(Maven项目),java,maven,junit,Java,Maven,Junit,Jenkins是新手,所以我有一个JavaWeb项目(maven)和一个单元测试文件。 测试文件结构:src/Test/java/PreProcessorTest.java 该测试已在intellij中成功执行。但是Jenkins并没有考虑这个测试文件,并说构建是成功的 它显示“没有要运行的测试” 詹金斯控制台日志 提交消息:“更新pom.xml” 解析pom 已在33330上建立TCP套接字 maven35-agent.jar已经是最新的 maven35-interceptor.jar已经是最

Jenkins是新手,所以我有一个JavaWeb项目(maven)和一个单元测试文件。 测试文件结构:src/Test/java/PreProcessorTest.java

该测试已在intellij中成功执行。但是Jenkins并没有考虑这个测试文件,并说构建是成功的

它显示“没有要运行的测试”

詹金斯控制台日志

提交消息:“更新pom.xml” 解析pom 已在33330上建立TCP套接字 maven35-agent.jar已经是最新的 maven35-interceptor.jar已经是最新的 maven3-interceptor-commons.jar已经是最新的 [DEVACDMY-29158]$java-cp/home/jenkins/jenkins/maven35 agent.jar:/home/jenkins/jenkins/tools/hudson.tasks.Maven_-MavenInstallation/Maven_3.5/boot/plexus-classworlds-2.5.2.jar:/home/jenkins/jenkins/tools/hudson.tasks.Maven_-MavenInstallation/Maven_3.5/conf/logging jenkins.maven3.agent.Maven35Main/home/jenkins/jenkins/tools/hudson.tasks.Maven_-MavenInstallation/Maven_3.5/home/jenkins/jenkins/remoting.jar/home/jenkins/jenkins/maven35-interceptor.jar/home/jenkins/jenkins/maven3-interceptor-commons.jar 33330 频道启动 执行Maven:-B-f/home/jenkins/jenkins/workspace/DEVACDMY-29158/pom.xml安装 [信息]正在扫描项目。。。 [警告] [警告]为groupId:npl:jar:1.0-SNAPSHOT构建有效模型时遇到一些问题 [警告]“dependencies.dependency.(groupId:artifactId:type:classifier)”必须是唯一的:org.mockito:mockito all:jar->版本2.0.2-beta的重复声明@第85行,第21列 [警告] [警告]强烈建议修复这些问题,因为它们会威胁到构建的稳定性。 [警告] [警告]出于这个原因,未来的Maven版本可能不再支持构建这种格式错误的项目。 [警告] [信息] [信息]----------------------------------------------------------------- [信息]建筑npl 1.0-SNAPSHOT [信息]------------------------------------[jar]--------------------------------- [信息] [信息]---maven资源插件:2.6:resources(默认资源)@npl--- [警告]使用平台编码(实际上是UTF-8)复制过滤后的资源,即构建依赖于平台! [信息]跳过不存在的resourceDirectory/home/jenkins/jenkins/workspace/DEVACDMY-29158/src/main/resources [信息] [信息]---maven编译器插件:3.1:compile(默认编译)@npl--- [信息]无需编译-所有类都是最新的 [信息] [信息]---maven资源插件:2.6:testResources(默认testResources)@npl--- [警告]使用平台编码(实际上是UTF-8)复制过滤后的资源,即构建依赖于平台! [信息]跳过不存在的resourceDirectory/home/jenkins/jenkins/workspace/DEVACDMY-29158/src/test/resources [信息] [信息]---maven编译器插件:3.1:testCompile(默认testCompile)@npl--- [信息]检测到更改-重新编译模块! [警告]未使用平台编码UTF-8设置文件编码,即生成依赖于平台! [信息]将2个源文件编译到/home/jenkins/jenkins/workspace/DEVACDMY-29158/target/test类 [信息] [信息]---maven surefire插件:2.8.1:test(默认测试)@npl--- [信息]Surefire报告目录:/home/jenkins/jenkins/workspace/DEVACDMY-29158/target/Surefire报告 ------------------------------------------------------- T T S T S ------------------------------------------------------- 没有要运行的测试。 结果: 测试运行:0,失败:0,错误:0,跳过:0 [詹金斯]记录测试结果 [信息] [信息]---maven jar插件:2.4:jar(默认jar)@npl--- [信息]构建jar:/home/jenkins/jenkins/workspace/DEVACDMY-29158/target/npl-1.0-SNAPSHOT.jar [信息] [信息]---maven安装插件:2.4:install(默认安装)@npl--- [信息]安装/home/jenkins/jenkins/workspace/DEVACDMY-29158/target/npl-1.0-SNAPSHOT.jar到/home/jenkins/.m2/repository/groupId/npl/1.0-SNAPSHOT/npl-1.0-SNAPSHOT.jar [信息]安装/home/jenkins/jenkins/workspace/DEVACDMY-29158/pom.xml至/home/jenkins/.m2/repository/groupId/npl/1.0-SNAPSHOT/npl-1.0-SNAPSHOT.pom 已开始计算生成的磁盘使用率 在0秒内完成了生成的磁盘使用率计算 已开始计算工作区的磁盘使用率 在0秒内完成了工作区磁盘使用率的计算 [信息]------------------------------------------------------------------------ [信息]建立成功 [信息]------------------------------------------------------------------------ [信息]总时间:15.300秒 [信息]完成时间:2020-03-19T04:06:01-05:00 [信息]------------------------------------------------------------------------ 等待Jenkins完成数据收集 [JENKINS]存档/home/JENKINS/JENKINS/workspace/DEVACDMY-29158/pom.xml到groupId/npl/1.0-SNAPSHOT/npl-1.0-SNAPSHOT.pom [JENKINS]存档/home/JENKINS/JENKINS/workspace/DEVACDMY-29158/target/npl-1.0-SNAPSHOT.jar到groupId/npl/1.0-SNAPSHOT/npl-1.0-SNAPSHOT.jar 通道停止 已开始计算生成的磁盘使用率 在0秒内完成了生成的磁盘使用率计算 已开始计算工作区的磁盘使用率 在0秒内完成了工作区磁盘使用率的计算 完成:成功 pom.xml


4.0.0
1.8
1.8
5.6.0
11
src/test/java
org.apache.maven.plugins
maven surefire插件
2.8.1
groupId
不良贷款
1.0-快照
org.apache.tomcat
TomcatServletAPI
8.5.0
朱尼特
朱尼特
4.13
测试
org.junit.jupiter
朱尼特木星发动机
5.6.0
mysql
mysql连接器java
5.1.17
罐子
Commit message: "Update pom.xml"
Parsing POMs
Established TCP socket on 33330
maven35-agent.jar already up to date
maven35-interceptor.jar already up to date
maven3-interceptor-commons.jar already up to date
[DEVACDMY-29158] $ java -cp /home/jenkins/jenkins/maven35-agent.jar:/home/jenkins/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven_3.5/boot/plexus-classworlds-2.5.2.jar:/home/jenkins/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven_3.5/conf/logging jenkins.maven3.agent.Maven35Main /home/jenkins/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven_3.5 /home/jenkins/jenkins/remoting.jar /home/jenkins/jenkins/maven35-interceptor.jar /home/jenkins/jenkins/maven3-interceptor-commons.jar 33330
<===[JENKINS REMOTING CAPACITY]===>channel started
Executing Maven:  -B -f /home/jenkins/jenkins/workspace/DEVACDMY-29158/pom.xml install
[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for groupId:npl:jar:1.0-SNAPSHOT
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.mockito:mockito-all:jar -> duplicate declaration of version 2.0.2-beta @ line 85, column 21
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO] 
[INFO] ----------------------------< groupId:npl >-----------------------------
[INFO] Building npl 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ npl ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/jenkins/jenkins/workspace/DEVACDMY-29158/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ npl ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ npl ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/jenkins/jenkins/workspace/DEVACDMY-29158/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ npl ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 2 source files to /home/jenkins/jenkins/workspace/DEVACDMY-29158/target/test-classes
[INFO] 
[INFO] --- maven-surefire-plugin:2.8.1:test (default-test) @ npl ---
[INFO] Surefire report directory: /home/jenkins/jenkins/workspace/DEVACDMY-29158/target/surefire-reports
-------------------------------------------------------
 T E S T S
-------------------------------------------------------
There are no tests to run.

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

[JENKINS] Recording test results
[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ npl ---
[INFO] Building jar: /home/jenkins/jenkins/workspace/DEVACDMY-29158/target/npl-1.0-SNAPSHOT.jar
[INFO] 
[INFO] --- maven-install-plugin:2.4:install (default-install) @ npl ---
[INFO] Installing /home/jenkins/jenkins/workspace/DEVACDMY-29158/target/npl-1.0-SNAPSHOT.jar to /home/jenkins/.m2/repository/groupId/npl/1.0-SNAPSHOT/npl-1.0-SNAPSHOT.jar
[INFO] Installing /home/jenkins/jenkins/workspace/DEVACDMY-29158/pom.xml to /home/jenkins/.m2/repository/groupId/npl/1.0-SNAPSHOT/npl-1.0-SNAPSHOT.pom
Started calculate disk usage of build
Finished Calculation of disk usage of build in 0 seconds
Started calculate disk usage of workspace
Finished Calculation of disk usage of workspace in 0 seconds
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15.300 s
[INFO] Finished at: 2020-03-19T04:06:01-05:00
[INFO] ------------------------------------------------------------------------
Waiting for Jenkins to finish collecting data
[JENKINS] Archiving /home/jenkins/jenkins/workspace/DEVACDMY-29158/pom.xml to groupId/npl/1.0-SNAPSHOT/npl-1.0-SNAPSHOT.pom
[JENKINS] Archiving /home/jenkins/jenkins/workspace/DEVACDMY-29158/target/npl-1.0-SNAPSHOT.jar to groupId/npl/1.0-SNAPSHOT/npl-1.0-SNAPSHOT.jar
channel stopped
Started calculate disk usage of build
Finished Calculation of disk usage of build in 0 seconds
Started calculate disk usage of workspace
Finished Calculation of disk usage of workspace in 0 seconds
Finished: SUCCESS
<project xmlns="http://maven.apache.org/POM/4.0.0"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
       <properties>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.compiler.source>1.8</maven.compiler.source>
           <junit.jupiter.version>5.6.0</junit.jupiter.version>
           <maven.compiler.release>11</maven.compiler.release>
                 <project.build.testSourceDirectory>src/test/java</project.build.testSourceDirectory>
    </properties>
             <build>
             <plugins>
             <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.8.1</version>
    </plugin>
             </plugins>
             </build>

        <groupId>groupId</groupId>
        <artifactId>npl</artifactId>
        <version>1.0-SNAPSHOT</version>
        <dependencies>
            <!-- https://mvnrepository.com/artifact/org.apache.tomcat/tomcat-servlet-api -->
            <dependency>
                <groupId>org.apache.tomcat</groupId>
                <artifactId>tomcat-servlet-api</artifactId>
                <version>8.5.0</version>
            </dependency>
           <!-- https://mvnrepository.com/artifact/junit/junit -->
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.13</version>
        <scope>test</scope>
    </dependency>
     <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter-engine</artifactId>
                <version>5.6.0</version>
            </dependency>
            <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
                <version>5.1.17</version>
                <type>jar</type>
                <scope>provided</scope>
            </dependency>

            <!-- https://mvnrepository.com/artifact/edu.stanford.nlp/stanford-corenlp -->
            <dependency>
                <groupId>edu.stanford.nlp</groupId>
                <artifactId>stanford-corenlp</artifactId>
                <version>3.9.2</version>
                <scope>provided</scope>
            </dependency>
            <!-- https://mvnrepository.com/artifact/edu.stanford.nlp/corenlp -->




            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-simple</artifactId>
                <version>1.6.2</version>
                <scope>test</scope>
            </dependency>
            <!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
            <dependency>
                <groupId>commons-io</groupId>
                <artifactId>commons-io</artifactId>
                <version>2.6</version>
            </dependency>

            <!-- https://mvnrepository.com/artifact/org.mockito/mockito-all -->
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-all</artifactId>
                <version>2.0.2-beta</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-all</artifactId>
                <version>2.0.2-beta</version>
                <scope>compile</scope>
            </dependency>
       </dependencies>
       </project>
 C:\Users\AP078081\IdeaProjects\npl>mvn test
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for groupId:npl:jar:1.0-SNAPSHOT
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.mockito:mockito-all:jar -> duplicate declaration of version 2.0.2-beta @ line 74, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ----------------------------< groupId:npl >-----------------------------
[INFO] Building npl 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ npl ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ npl ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ npl ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\AP078081\IdeaProjects\npl\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ npl ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ npl ---
[INFO] Surefire report directory: C:\Users\AP078081\IdeaProjects\npl\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  2.053 s
[INFO] Finished at: 2020-03-19T15:53:37+05:30
[INFO] ------------------------------------------------------------------------
<groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.8.1</version>
<groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>3.0.0-M4</version>
if the JUnit 5 Platform Engine is present in the project
    use junit-platform
if the JUnit version in the project >= 4.7 and the <<<parallel>>> configuration parameter has ANY value
    use junit47 provider
if JUnit >= 4.0 is present
    use junit4 provider
else
    use junit3.8.1
<build>
   <plugins>
      <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-surefire-plugin</artifactId>
      <version>2.19.1</version>
      <dependencies>
         <dependency>
           <groupId>org.junit.platform</groupId>
           <artifactId>junit-platform-surefire-provider</artifactId>
           <version>${org.junit.platform.version}</version>
         </dependency>
         <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>${org.junit.version}</version>
         </dependency>
      </dependencies>
      </plugin>
   </plugins>
</build>