1

我发现当我使用 org.ops4j.pax.exam.CoreOptions.mavenBundle 从 maven 存储库部署包时,部署时间不到一分钟,但是当我使用 org.ops4j.pax.exam.CoreOptions 部署相同的包时.bundle,指定文件:本地文件系统上捆绑包的 url,部署需要 8 分钟以上。我预计 CoreOptions.bundle 会更快,因为它正在访问本地文件。使用 CoreOptions.bundle 时,我可以做些什么来加快部署速度?

以下是我正在使用的版本:

<dependency>
  <groupId>org.ops4j.pax.exam</groupId>
  <artifactId>pax-exam-container-karaf</artifactId>
  <version>4.4.0</version>
</dependency>
<dependency>
  <groupId>org.ops4j.pax.exam</groupId>
  <artifactId>pax-exam-junit4</artifactId>
  <version>4.4.0</version>
</dependency>
<dependency>
  <groupId>org.ops4j.pax.exam</groupId>
  <artifactId>pax-exam</artifactId>
  <version>4.4.0</version>
</dependency>
<dependency>
  <groupId>org.ops4j.pax.url</groupId>
  <artifactId>pax-url-aether</artifactId>
  <version>2.4.0</version>
</dependency>

这是我用来从文件系统部署包的代码:

// Inject our local bundle dependencies
URI deployBundlesDirUri = new File(deployBundlesDir).toURI();
for (String bundle : localBundles) {
    String name = deployBundlesDirUri.resolve(bundle).toString();
    options.add(bundle(name).start());
}

这是我从 maven repo 部署相同包时使用的代码:

// Inject our maven dependencies
for (String[] dep : mavenDependencies) {
    options.add(mavenBundle()
           .groupId(dep[0])
           .artifactId(dep[1])
           .versionAsInProject().update(true).start()
    );
}
4

0 回答 0