Gradle 包装器编译和构建代码和 运行 单个单元测试

Gradle Wrapper compile and build code and run a single unit test

大家好,我在使用 gradle 包装器时遇到了一些麻烦。 有什么好的方法可以编译我所有的代码,编译我所有的测试,并且 运行 一个测试。 这是 Jenkins 管道中的脚本命令。

我用过

感谢您的帮助

请参阅 gradle 文档 https://docs.gradle.org/current/userguide/java_testing.html#test_filtering

# Executes all tests in SomeTestClass
gradle test --tests SomeTestClass

# Executes a single specified test in SomeTestClass
gradle test --tests SomeTestClass.someSpecificMethod

gradle test --tests SomeTestClass.*someMethod*

# specific class
gradle test --tests org.gradle.SomeTestClass

# specific class and method
gradle test --tests org.gradle.SomeTestClass.someSpecificMethod