Rya*_*tts 5 java integration-testing maven jboss-arquillian
我在网上找到了一些零碎的知识,但无法将它们组合起来来解决这个具体案例。这个答案似乎是一个很好的开始,但它专门处理 EAR 依赖关系。
我的(简化的)maven项目结构如下:
parent
|__domain (a jar)
|__domain-it (integration tests for the domain module)
|__web (a war; depends on domain)
|__web-it (integration tests for the web module)
Run Code Online (Sandbox Code Playgroud)
我正在寻找以下问题的解决方案:
web。web-it模块中。web模块依赖于domain模块,web-it因此集成测试还需要将domain模块中的代码放在类路径上。domain都web依赖于一些第三方库,例如
org.apache.commons:commons-lang3测试类路径上也需要这些库。我正在 Glassfish 3.1.2 上运行。
任何帮助,将不胜感激。对我来说很奇怪的是,没有针对这种情况的具体 Arquillian 文档,因为我认为这是一种非常常见的情况。也许我错过了一些基本的东西?
以下是我迄今为止尝试过的一些方法:
通过添加以下内容来建立web-it依赖,如下所示:webweb-it/pom.xml
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>web</artifactId>
<version>${project.version}</version>
<scope>test</scope>
<type>war</type>
</dependency>
Run Code Online (Sandbox Code Playgroud)
但这不会包括web测试类路径上的任何类
通过配置 的 war 插件来生成依赖web-it于 的类,以生成附加的类 jar。在:webwebweb/pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<attachClasses>true</attachClasses>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
在web-it/pom.xml:
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>web</artifactId>
<version>${project.version}</version>
<scope>test</scope>
<classifier>classes</classifier>
</dependency>
Run Code Online (Sandbox Code Playgroud)
这包括测试类路径上的类web,但不包括传递依赖项(例如commons-lang3)。
我也考虑过,但尚未尝试:
| 归档时间: |
|
| 查看次数: |
1082 次 |
| 最近记录: |