我有模块A和模块B的maven项目,它依赖于模块A. 例如,我在模块A中有抽象单元测试,我想在模块B的单元测试中使用这个单元测试。 有没有办法实现这一目标?
答案 0 :(得分:2)
You'll want to use the <goal>test-jar</goal>
execution of the maven-jar-plugin
to make the Jar file, then simpy include it as a dependency in your other project, by adding <type>
and <scope>
attributes in the definition of that dependency:
<dependency>
...
<type>test-jar</type>
<scope>test</scope>
</dependency>
答案 1 :(得分:1)
是,在this guide之后的模块A中声明模块B中的依赖关系。