1

我正在尝试将以下 jar(以及其他)嵌入到 OSGi 包中。

<dependency>
    <groupId>com.sun.xml.bind</groupId>
    <artifactId>jaxb-xjc</artifactId>
    <version>2.1.13</version>
</dependency>

maven-bundle-plugin 具有以下设置错误,Classes found in the wrong directory: {1.0/com/sun/codemodel/util/Surrogate$Parser.class=com.sun.codemodel.util.Surrogate$Parser, ...many more of these...}因为此 jar 在 jar 的根目录下名为 1.0 的文件夹中有一堆类文件作为资源,这会将其丢弃。我该如何解决这个问题?

       <plugin>
            <groupId>org.apache.felix</groupId>
            <artifactId>maven-bundle-plugin</artifactId>
            <version>3.0.0</version>

            <configuration>
                <instructions>
                    <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
                    <Embed-Transitive>true</Embed-Transitive>
                    <Export-Package>a.single.package.i.want.to.export</Export-Package>
                    <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
                </instructions>
            </configuration>
        </plugin>
4

1 回答 1

0

我遇到过同样的问题。看来我在 pom.xml 中有两个冲突的版本。通过排除其中一个版本,我可以解决问题。

<dependency>
    <groupId>uk.ac.ebi.chebi.webapps.chebiWS.client</groupId>
    <artifactId>chebiWS-client</artifactId>
    <version>2.2.2</version>
    <exclusions>
        <exclusion>
            <groupId>com.sun.xml.ws</groupId>
            <artifactId>jaxws-tools</artifactId>
        </exclusion>
    </exclusions>
</dependency>
于 2016-08-02T15:33:36.687 回答