有没有人尝试过用Bndtools运行PaxExam Junit测试,并能给我一些建议?我自己尝试过,但是如果没有Maven,下载所有依赖项都会很痛苦。
我到目前为止所做的事:
我想使用PaxExam,因为它们只生成测试报告,而不是真正的"Junit测试“,所以与Ant任务一起使用它更容易。
后一种情况:
以上场景已经适用于不运行Junit4环境的普通OSGi测试,但现在我想进行积测试。
有人能帮我吗?
欢迎光临。
发布于 2012-08-01 09:52:32
即使您没有使用Maven来构建您的项目,您仍然可以使用它来下载maven-工件及其传递的依赖关系。要做到这一点,您首先必须使用安装Maven。然后,创建一个空目录,在该目录中创建一个名为pom.xml的文件。对于Pax考试,这个应该是这样的:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>test</groupId>
<artifactId>test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<exam.version>2.5.0</exam.version>
<url.version>1.4.2</url.version>
</properties>
<dependencies>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-container-native</artifactId>
<version>${exam.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-junit4</artifactId>
<version>${exam.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-link-mvn</artifactId>
<version>${exam.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.url</groupId>
<artifactId>pax-url-aether</artifactId>
<version>${url.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.framework</artifactId>
<version>3.2.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>0.9.29</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>0.9.29</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>我已经从Pax考试文件获取了依赖项列表。然后,打开命令行,导航到创建pom.xml的目录,并执行以下命令:
mvn dependencies:copy-dependencies(这假设您已经安装了Maven,因此命令mvn可以从命令行中获得)。现在,maven将获取您在pom.xml中指定的依赖项的所有传递依赖项,并默认情况下将它们存储在target/dependency中。
https://stackoverflow.com/questions/11748444
复制相似问题