【问题标题】:How to get a Fragment-Bundle into Tycho test runtime?如何将 Fragment-Bundle 放入 Tycho 测试运行时?
【发布时间】:2012-11-07 10:12:23
【问题描述】:

我有一个依赖于它的实现包和片段包(清单中的片段主机)。此外,还有一个包含一些测试的捆绑包。

现在我想测试我的实现并使用 tycho-surefire-plugin。带有测试的捆绑包通过 MANIFEST 中的 Require-Bundle 引用实现捆绑包。 到目前为止,一切都很好。问题是如何将片段包放入测试运行时?我已经在我的 eclipse-test-plugin 中尝试了 tycho-surefire-plugin 配置中的依赖关系。但它不起作用。什么是正确的方法?

编辑: 我的测试插件的 pom.xml

    <plugin>
     <groupId>org.eclipse.tycho</groupId>
     <artifactId>tycho-surefire-plugin</artifactId>
     <version>${tycho-version}</version>
     <configuration>
      <testSuite>com.example.impl.tests</testSuite>
      <testClass>com.example.impl.tests.MyTest</testClass>
      <dependencies>
       <dependency>
       <type>eclipse-plugin</type>
       <artifactId>com.example.impl.config</artifactId>
       <version>1.0.0</version>
      </dependency>         
    </dependencies>
    </configuration>
    </plugin>

片段包的清单:

    Manifest-Version: 1.0
    Bundle-ManifestVersion: 2
    Bundle-Name: com.example.config
    Bundle-SymbolicName: com.example.config
    Bundle-Version: 1.0.0.qualifier
    Bundle-Vendor: example
    Fragment-Host: com.example.impl;bundle-version="1.0.0.qualifier"
    Bundle-ClassPath: resources/
    Bundle-RequiredExecutionEnvironment: JavaSE-1.7

从反应堆 pom.xml 中提取:

    <modules>
     <module>../com.example.impl</module> 
     <module>../com.example.impl.config</module>
     <module>../com.example.impl.tests</module>
    </module>

谢谢!

【问题讨论】:

  • 在 tycho-surefire-plugin 的配置中添加依赖是正确的做法。您能否提供您尝试的配置的详细信息?
  • 我自己找到了答案。如果有人遇到同样的问题:Fragment-Host bundle-version 中的 .qualifier 版本不会被 Tycho 自动扩展。
  • 安娜,既然你已经找到了你自己问题的答案,你应该把这个写成答案。 Stack Overflow 明确鼓励回答您自己的问题,以便其他人可以从您的见解中受益。

标签: osgi tycho osgi-fragment


【解决方案1】:

似乎我自己找到了答案。万一有人遇到同样的问题:Tycho 不会自动扩展 Fragment-Host bundle-version 中的 .qualifier 版本。

【讨论】:

  • 你是怎么想到的?因为我认为如果这是真的,那就是一个错误,不是吗?
猜你喜欢
  • 2012-03-31
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-10-22
  • 1970-01-01
相关资源
最近更新 更多