首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何修复maven surefire插件错误[ forked进程中有错误]?

如何修复maven surefire插件错误[ forked进程中有错误]?
EN

Stack Overflow用户
提问于 2019-03-27 00:56:44
回答 3查看 21.5K关注 0票数 2

我正在尝试运行我的使用Maven- testNG-cucumber的示例项目,并使用docker部署它。这是我的Dockerfile

代码语言:javascript
运行
复制
FROM    maven:3.6.0-jdk-8
RUN     mkdir /docker
WORKDIR /docker
COPY    pom.xml .
COPY    testng.xml .
COPY    src .
RUN     mvn clean verify

POM.XML

代码语言:javascript
运行
复制
info.cukes
        cucumber-java
        1.2.5
        test
    
    
        info.cukes
        cucumber-jvm-deps
        1.0.5
        test
    
    
        info.cukes
        cucumber-testng
        1.2.5
        compile
        
            
                junit
                junit
            
        
    
    
        org.testng
        testng
        6.9.8
        test
    
    
        net.masterthought
        cucumber-reporting
        3.8.0
    
    
        org.seleniumhq.selenium
        selenium-java
        2.44.0
    




    
        
            org.apache.maven.plugins
            maven-resources-plugin
            2.4
        
        
            org.apache.maven.plugins
            maven-surefire-plugin
            2.20.1
            
                
                    testng.xml
                
                false
            
        
        
            net.masterthought
            maven-cucumber-reporting
            3.8.0
            
                
                    execution
                    verify
                    
                        generate
                    
                    
                        Sample
                        target/cucumber-reports/advanced-reports
                        target/cucumber-reports/CucumberTestReport.json
                        1
                        false

当我使用以下命令在本地运行项目时,上述方案完全可以正常工作

mvn验证.Then我尝试使用以下命令构建映像docker build -t示例。

..。这一次,我得到了以下错误。

代码语言:javascript
运行
复制
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.20.1:test (default-test) on project Sample: There are test failures.
 [ERROR] Please refer to /docker/target/surefire-reports for the individual test results.

 [ERROR] Please refer to dump files (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and [date]-jvmRun[N].dumpstream.

 [ERROR] There was an error in the forked process

 [ERROR] Cannot find class in classpath: TestRunner
 [ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: There was an error in the forked process

 [ERROR] Cannot find class in classpath: TestRunner
 [ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork
 (ForkStarter.java:673)
 [ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork
 (ForkStarter.java:535)
 [ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run 
 (ForkStarter.java:280)
 [ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run
 (ForkStarter.java:245)
 [ERROR] at 
 org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider
 (AbstractSurefireMojo.java:1124)
 [ERROR]         at 
 org.apache.maven.plugin.surefire.AbstractSurefireMojo.
 executeAfterPreconditionsChecked(AbstractSurefireMojo.java:954)

如有任何帮助,我们将不胜感激。

EN

Stack Overflow用户

发布于 2020-08-05 14:20:05

我遇到了类似的问题,在使用旧版本的maven-surefire-plugin 解决了我的问题。

代码语言:javascript
运行
复制
maven-surefire-plugin
            
            2.19.1
            
                
                    org.junit.platform
                    junit-platform-surefire-provider
                    1.0.3
                
                
                    org.junit.jupiter
                    junit-jupiter-engine
                    5.0.3
票数 0
EN
查看全部 3 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55362476

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档