簡體   English   中英

maven-bundle-plugin不包含Import-Package

[英]maven-bundle-plugin doesn't include Import-Package

我有父母pom,我的孩子pom就像一個模塊。

在我孩子的包中,我有類似的東西

<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>

但是在Manifest中,我得到了類似的東西

javax.jws,
javax.jws.soap,
javax.xml.bind,
javax.xml.bind.annotation,
javax.xml.bind.annotation.adapters,
javax.xml.datatype,
javax.xml.namespace

但我沒有得到我的oracle.sql和oracle.jdbc。

當我從父文件夾進行mvn clean install時會發生這種情況。 如果我在我的孩子pom所在的目錄中進行mvn clean install ,一切正常。 但是在我看到Jenkin的構建不包括oracle的軟件包之后發生了問題。

在這種情況下有趣的是,我還有其他模塊,包括* oracle的**包,並且在構建它們的清單后也有它。

請在依賴項部分的pom.xml中添加以下依賴項。

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

之后你可以檢查。

我發現了我的錯誤。 我有這個插件,但Jenkins創建沒有任何配置文件的包,所以它生成沒有我的Import-Package。

看起來像

<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>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM