maven-bundle-plugin不包含Import-Package

时间:2019-05-21 13:10:13

标签: java maven

我有一个父pom,而我的子pom就像一个模块一样位于

在我的孩子包的pom中,我有类似的东西

DisplayMember

但是在清单中,我得到了类似的东西

<plugin>
                    <groupId>org.apache.felix</groupId>
                    <artifactId>maven-bundle-plugin</artifactId>
                    <version>3.0.1</version>
                    <configuration>
                        <instructions>
                            <Bundle-SymbolicName>...</Bundle-SymbolicName>
                            <Bundle-Description>...</Bundle-Description>
                            <Bundle-Activator>...</Bundle-Activator>
                            <Import-Package>
                                oracle.sql,
                                oracle.jdbc,
                                javax.jws,
                                javax.jws.soap,
                                javax.xml.bind,
                                javax.xml.bind.annotation,
                                javax.xml.namespace,
                                javax.xml.ws,
                                *
                            </Import-Package>
                            <Export-Package>
                            </Export-Package>
                        </instructions>
                    </configuration>
</plugin>

但是我没有oracle.sql和oracle.jdbc。

当我从父文件夹中创建javax.jws, javax.jws.soap, javax.xml.bind, javax.xml.bind.annotation, javax.xml.bind.annotation.adapters, javax.xml.datatype, javax.xml.namespace 时会发生这种情况。如果我在子pom所在的目录中输入mvn clean install,一切正常。但是当我看到Jenkin的版本不包含 oracle's 软件包后,问题就发生了。

在这种情况下很有趣,我还有其他模块,其中也包括* oracle'**软件包,并且在构建它们的清单后也有该模块。

2 个答案:

答案 0 :(得分:0)

请在“依赖项”部分的pom.xml中添加以下依赖项。

<dependency>
    <groupId>com.oracle</groupId>
    <artifactId>ojdbc14</artifactId>
    <version>10.2.0.4.0</version>
</dependency>

之后,您可以检查。

答案 1 :(得分:0)

我发现了我的错误。 我内部有该插件,但是Jenkins创建的包没有任何配置文件,因此,它是在没有导入包的情况下生成的。

看起来像

<profiles>
    <profile>
        <id>My-Own-Profile</id>
            <build>
             <plugins>
                <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>3.0.1</version>
                <configuration>
                    <instructions>
                        <Bundle-SymbolicName>...</Bundle-SymbolicName>
                        <Bundle-Description>...</Bundle-Description>
                        <Bundle-Activator>...</Bundle-Activator>
                        <Import-Package>
                            oracle.sql,
                            oracle.jdbc,
                            javax.jws,
                            javax.jws.soap,
                            javax.xml.bind,
                            javax.xml.bind.annotation,
                            javax.xml.namespace,
                            javax.xml.ws,
                            *
                        </Import-Package>
                        <Export-Package>
                        </Export-Package>
                    </instructions>
                </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>

但是我应该让它像

<profiles>
    <profile>
        <id>My-Own-Profile</id>
            <build>
             <plugins>
                <plugin>
                  **SOME PLUGIN FOR THAT PROFILE**
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>
           <build>
             <plugins>
                <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>3.0.1</version>
                <configuration>
                    <instructions>
                        <Bundle-SymbolicName>...</Bundle-SymbolicName>
                        <Bundle-Description>...</Bundle-Description>
                        <Bundle-Activator>...</Bundle-Activator>
                        <Import-Package>
                            oracle.sql,
                            oracle.jdbc,
                            javax.jws,
                            javax.jws.soap,
                            javax.xml.bind,
                            javax.xml.bind.annotation,
                            javax.xml.namespace,
                            javax.xml.ws,
                            *
                        </Import-Package>
                        <Export-Package>
                        </Export-Package>
                    </instructions>
                </configuration>
                </plugin>
            </plugins>
        </build>