Ant 将PaxExam与Bndtools一起使用

Ant 将PaxExam与Bndtools一起使用,ant,hudson,osgi,pax-exam,bndtools,Ant,Hudson,Osgi,Pax Exam,Bndtools,有没有人尝试过用Bndtools运行paxexamjunit测试,可以给我一些建议?我自己也尝试过,但是没有Maven,下载所有依赖项是一件痛苦的事情 到目前为止我所做的: 从Central Maven下载PaxExam依赖项还有更简单的方法吗? 在cnf/bnd.bnd中创建包含所有依赖项的属性 将属性添加到要在其中编写测试的buildpath 执行测试失败,缺少更多依赖项,请返回1:D 我想使用PaxExam,它更容易与Ant Junit任务一起用作Bndtools的集成测试,因为它们只生成

有没有人尝试过用Bndtools运行paxexamjunit测试,可以给我一些建议?我自己也尝试过,但是没有Maven,下载所有依赖项是一件痛苦的事情

到目前为止我所做的:

从Central Maven下载PaxExam依赖项还有更简单的方法吗? 在cnf/bnd.bnd中创建包含所有依赖项的属性 将属性添加到要在其中编写测试的buildpath 执行测试失败,缺少更多依赖项,请返回1:D 我想使用PaxExam,它更容易与Ant Junit任务一起用作Bndtools的集成测试,因为它们只生成测试报告,而不是真正的Junit测试

后面的场景:

与Hudson和Ant建立项目 Hudson还应该执行Junit Ant任务,失败的测试也应该停止构建过程 上面的场景已经可以在不运行OSGi环境的情况下使用普通的Junit4测试,但是现在我想做集成测试

有人能帮我吗


你好

即使不使用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>

这假设您已经安装了Maven,以便命令行中可以使用命令mvn。现在,maven将获取您在pom.xml中指定的依赖项的所有可传递依赖项,并在默认情况下将它们存储在target/dependency中。

即使您不使用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>

这假设您已经安装了Maven,以便命令行中可以使用命令mvn。现在,maven将获取您在pom.xml中指定的依赖项的所有可传递依赖项,并在默认情况下将它们存储在target/dependency中。

您是否考虑过将maven与maven Bundle插件一起使用,而不是使用ant+bndtools?在我看来,Bndtools比MBP好得多,因为它在某些情况下使开发更容易。所以,是的,我看了一下,但决定使用Bndtools;为什么bnd的测试报告不是“真实的”单元测试?嗨,Peter,我真的不能给你一个答案,因为我不记得为什么我会遇到问题,并要求我为PaxExam提供建议。也许这是我当时唯一的可能,或者我没有现在那么有经验;可能是因为我错过了Bndtools和JUnit视图之间的套接字通信,无法在那里生成输出,不仅是控制台的失败和成功输出——但我记不清了:您是否考虑过简单地将Maven与Maven Bundle插件一起使用,而不是使用ant+Bndtools?在我看来,Bndtools比MBP好得多,因为它在某些情况下使开发更容易。所以,是的,我看了一下,但决定使用Bndtools;为什么bnd的测试报告不是“真实的”单元测试?嗨,Peter,我真的不能给你一个答案,因为我不记得为什么我会遇到问题,并要求我为PaxExam提供建议。也许这是我当时唯一的可能,或者我没有现在那么有经验;这可能是因为我错过了Bndtools和JUnit视图之间的套接字通信,无法在那里生成输出,不仅是失败和成功的控制台输出,而且记不清了:有趣的故事:我已经想过按照您在回答中描述的那样做;所以你从我这里得到+1:但无论如何,也许还有其他方法。我满怀希望地接受了你的回答,因为这似乎是唯一的办法:所以对我来说,这是最有帮助的办法。祝贺你可以悬赏你的问题,以获得更多的意见,并鼓励人们更认真地思考。有趣的故事:我已经想过要像你在回答中描述的那样去做;所以你从我这里得到+1:但无论如何,也许还有其他方法。我满怀希望地接受了你的回答,因为这似乎是唯一的办法:所以对我来说,这是最有帮助的办法。祝贺你可以悬赏你的问题,以获得更多的意见,并鼓励人们更认真地思考。