【问题标题】:Pack ServletContainerInitializers from different bundles to a single OSGi bundle将不同包中的 ServletContainerInitializer 打包到单个 OSGi 包中
【发布时间】:2015-07-05 12:15:48
【问题描述】:

我正在创建一个包含以下依赖项的 OSGi 包

<artifactId>tomcat-dbcp</artifactId>
<artifactId>tomcat-embed-core</artifactId>
<artifactId>tomcat-embed-jasper</artifactId>
<artifactId>tomcat-embed-websocket</artifactId>
<artifactId>tomcat-jasper</artifactId>
<artifactId>ecj</artifactId>

我想在 websocket 和 jasper 中打包 SCI。

我的 IncludeResource 部分如下

<Include-Resource>
         {maven-resources},
         @tomcat-jasper-${version.tomcat}.jar!/META-INF/*,
         @tomcat-embed-websocket-${version.tomcat}.jar!/META-INF/*,
         src/main/resources
</Include-Resource>

这里的问题是我只得到 websocket SCi。我认为 jasper 资源被 websocket 资源覆盖。取决于我指定它们的顺序。

如何将两个资源放在同一个包中?

【问题讨论】:

  • 什么是“SCI”?请编辑您的问题。

标签: maven tomcat osgi maven-bundle-plugin


【解决方案1】:

我找到了答案。您可以为此使用 maven-shade-plugin。

例如 在我的场景中,我可以将两个 SCI 打包如下

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-shade-plugin</artifactId>
    <version>2.3</version>
    <executions>
      <execution>
        <phase>package</phase>
        <goals>
          <goal>shade</goal>
        </goals>
        <configuration>
          <transformers>
            <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
          </transformers>
        </configuration>
      </execution>
    </executions>
</plugin>

【讨论】:

    猜你喜欢
    • 2013-12-07
    • 1970-01-01
    • 2011-10-06
    • 2016-08-20
    • 2012-12-12
    • 1970-01-01
    • 1970-01-01
    • 2012-12-09
    • 1970-01-01
    相关资源
    最近更新 更多