我正在尝试运行我的使用Maven- testNG-cucumber的示例项目,并使用docker部署它。这是我的Dockerfile
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
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示例。
..。这一次,我得到了以下错误。
[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)
如有任何帮助,我们将不胜感激。
发布于 2020-08-05 14:20:05
我遇到了类似的问题,在使用旧版本的maven-surefire-plugin
解决了我的问题。
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
https://stackoverflow.com/questions/55362476
复制相似问题