简体   繁体   English

在特定类上运行Maven测试-[错误]无法执行目标org.apache.maven.plugins:maven-surefire-plugin:2.10:test

[英]Running maven test on a specific class - [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.10:test

Getting the following issue. 得到以下问题。 When I run mvn test -Dtest=MyClassTest 当我运行mvn test -Dtest=MyClassTest

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.10:test  
(default-test) on project my-project: No tests were executed!  (Set -DfailIfNoTests=false to 
ignore this error.) -> [Help 1]

But I have 10 other classes in the same project but on a different path. 但是我在同一项目中有10个其他类,但是路径不同。 I ran all of them like this and those all run fine. 我像这样跑所有的人,一切都很好。 But mvn test is not identifying just this one. 但是mvn测试不仅仅可以识别这一点。 Could there be any problems? 可能有什么问题吗?

I reviewed the same errors that people got, but was proposed different solutions like upgrade, etc. But for me, all tests run fine, except this one. 我检查了人们遇到的相同错误,但是提出了不同的解决方案,例如升级等。但是对我来说,除此测试外,所有测试都运行良好。 So I am kind of in limbo, if I am missing something. 因此,如果我缺少某些东西,我会陷入困境。

For those that have the same issue. 对于那些有相同问题的人。 Its my blunder (maybe). 这是我的失误(也许)。 The @Test annotated method has no access specifier. @Test注释的方法没有访问说明符。 I just use void method(). 我只是使用void method()。 I added public and it started working! 我添加了public ,它开始起作用!

Thanks @user2507946. 感谢@ user2507946。 Running from IDE help solve the issue. 从IDE运行有助于解决该问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法执行目标 org.apache.maven.plugins:maven-surefire-plugin:2.10:test - Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.10:test 无法执行目标org.apache.maven.plugins:maven-surefire-plugin:2.16:SAKAI中的测试错误 - Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.16:test error in SAKAI 无法执行目标org.apache.maven.plugins:maven-surefire-plugin:2.10:test没有执行任何测试 - Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.10:test no tests were executed 未能执行目标 org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M3:test - Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M3:test 无法执行目标 org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test on project XYZ - Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test on project XYZ 无法执行目标org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test - Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test 无法执行目标org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test - Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test 未能执行目标 org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test testng meaven - Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test testng meaven 尝试部署到 AZURE 时出错 无法执行目标 org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test - Error when trying to deploy to AZURE Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test org.apache.maven.lifecycle.LifecycleExecutionException:无法执行目标org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test - org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM