0

我正在创建一个 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 资源覆盖。取决于我指定它们的顺序。

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

4

1 回答 1

0

我找到了答案。您可以为此使用 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>
于 2015-04-27T09:09:33.023 回答