【发布时间】:2013-08-09 23:27:41
【问题描述】:
这是我当前的测试片段:
<packaging>eclipse-test-plugin</packaging>
<dependencies>
<dependency>
<groupId>org.junit</groupId>
<artifactId>com.springsource.org.junit</artifactId>
<version>4.7.0</version>
</dependency>
</dependencies>
使用以下插件配置:
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tycho.version}</version>
<configuration>
<dependencies>
<dependency>
<type>p2-installable-unit</type>
<artifactId>org.eclipse.equinox.ds</artifactId>
</dependency>
<dependency>
<type>p2-installable-unit</type>
<artifactId>org.apache.felix.gogo.shell</artifactId>
</dependency>
</dependencies>
<providerHint>junit47</providerHint>
<argLine>-ea</argLine>
</configuration>
</plugin>
我使用 POM-first 方法来解决依赖关系:
<pomDependencies>consider</pomDependencies>
上面的 JUnit 版本是我能找到的唯一一个,它被打包成一个包。
问题是我找不到允许我在片段中同时使用 JUnit 和 Mockito 的匹配项。
我的常见问题是:
- 来自 Maven Central 的 Mockito-core 需要 Hamcrest 1.0-2.0,但 JUnit 捆绑包在 4.7.0 版本中导出 Hamcrest
- Springsource 存储库中没有可用的 junit-dep 包
- 当我添加另一个 Hamcrest 包时,JUnit (4.7.0) 和 Hamcrest 包 (1.3) 导出的版本之间存在版本冲突
我想避免使用 JUnit、Hamcrest 和 Mockito 创建自己的包。
【问题讨论】:
-
Tycho 从来都不是 POM 优先的,这意味着 POM 是依赖声明的主要来源。在 Tycho 中,依赖项总是从清单中解决。使用
pomDependencies=consider,您只需激活一种机制即可将来自Maven 存储库的包添加到target platform。 (通常,这些包是使用 POM-first 方法构建的,即使用 maven-bundle-plugin。)
标签: junit osgi tycho hamcrest tycho-surefire-plugin