为Maven反应器嵌套子模块运行JUnit测试 [英] Run JUnit tests for Maven reactor nested sub-sub-module
问题描述
我正在使用深层嵌套的Maven反应堆项目:>
- root
pom.xml
指定模块dspace
- 模块
dspace
的pom.xml
指定模块modules
- 模块
modules
的pom.xml
指定(其中包括)模块rest
因此有一个嵌套的模块层次结构:dspace -> modules -> rest
.
我已经为(子-子)模块rest
编写了JUnit测试,并希望执行它们.如果我运行mvn test -pl rest
,则Maven失败:
[INFO] Scanning for projects...
[ERROR] [ERROR] Could not find the selected project in the reactor: rest @
[ERROR] Could not find the selected project in the reactor: rest -> [Help 1]
如何在嵌套的Maven模块中执行测试?
非常简单:mvn test -pl dspace/modules/rest
(或默认情况下禁用测试的情况,例如DSpace Maven项目示例:mvn -Dmaven.test.skip=false test -pl dspace/modules/rest
)
I'm working with a deeply nested Maven reactor project:
- root
pom.xml
specifies a moduledspace
- module
dspace
'spom.xml
specifies a modulemodules
- module
modules
'spom.xml
specifies (among others) a modulerest
So there is a nested module hierarchy: dspace -> modules -> rest
.
I have written JUnit tests for (sub-sub-)module rest
and would like to execute them. If I run mvn test -pl rest
, Maven fails:
[INFO] Scanning for projects...
[ERROR] [ERROR] Could not find the selected project in the reactor: rest @
[ERROR] Could not find the selected project in the reactor: rest -> [Help 1]
How can I execute tests in nested Maven modules?
Pretty easy: mvn test -pl dspace/modules/rest
(or when tests are deactivated by default, as it is the case with the example DSpace Maven project: mvn -Dmaven.test.skip=false test -pl dspace/modules/rest
)
这篇关于为Maven反应器嵌套子模块运行JUnit测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!