【问题标题】:Eclipse Juno doesn't "see" bundle created with apache felix maven-bundle-pluginEclipse Juno 没有“看到”使用 apache felix maven-bundle-plugin 创建的包
【发布时间】:2013-05-28 21:08:12
【问题描述】:

这是我的问题:我目前正在 Eclipse Juno 中开发简单的 RAP 应用程序。我需要使用一些外部库,所以我使用 felix maven-bundle-plugin 创建了一个捆绑包,其中存储了一些库。之后,我将此包复制到 Eclipse dropins 目录中。不幸的是,我无法在 MANIFEST.MF(依赖项 -> 必需插件 -> 添加)中将我的包添加到我的项目中,因为 Eclipse 看不到它。

我在 OSGI 控制台中检查了我的包,一切似乎都很好。状态已解决。我可以手动启动它而不会出现任何错误。 diag 命令也没有显示任何内容。

当我尝试在 Eclipse Indigo 中添加我的包时,一切正常 - 我可以在我的项目中使用它。

您知道可能出了什么问题吗?我正在为 maven-bundle-plugin 链接我的 pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project>
    <modelVersion>4.0.0</modelVersion>
    <packaging>bundle</packaging>

    <groupId>org.myproject</groupId>
    <artifactId>some-dependencies</artifactId>
    <version>1.0.0</version>
    <name>Dependencies</name>
    <description>Dependency bundle</description>        

    <repositories>
        <repository>
            <id>maven-restlet</id>  
            <name>Public online Restlet repository</name>  
            <url>http://maven.restlet.org</url> 
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>14.0.1</version>
        </dependency>
        <dependency>
            <groupId>org.restlet.jse</groupId>
            <artifactId>org.restlet</artifactId>
            <version>2.0.0</version>
        </dependency>
        <dependency>
            <groupId>org.restlet.jse</groupId>
            <artifactId>org.restlet.ext.json</artifactId>
            <version>2.0.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.felix</groupId>
            <artifactId>org.osgi.core</artifactId>
            <version>1.4.0</version>
        </dependency>           
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>2.3.7</version>
                <extensions>true</extensions>
                <configuration>
                    <instructions>                      
                        <Export-Package>com.google.common.*,org.restlet.*,org.json.*</Export-Package>
                        <Import-Package>!sun.misc,*</Import-Package>                        
                        <Bundle-SymbolicName>some-dependencies</Bundle-SymbolicName> 
                        <Eclipse-BuddyPolicy>global</Eclipse-BuddyPolicy>
                    </instructions> 
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

【问题讨论】:

    标签: eclipse osgi apache-felix maven-bundle-plugin


    【解决方案1】:

    如果您正在开发 RAP 应用程序,您将针对 RAP 目标平台而不是正在运行的 Eclipse 平台编译它。因此,添加到 Eclipse 运行时的包将不可用于工作区中的项目。您必须将您的捆绑包添加到目标平台。

    您可以在RAP Developer's Guide 中找到有关目标平台的简要说明。

    【讨论】:

    • 问题解决了!我创建了新的“来自现有 JAR 档案的插件”(为此使用了我的包 JAR)。之后,将其链接到我的项目并使用新库就没有问题了。
    【解决方案2】:

    要使 PDE 能够识别生成的清单文件,您必须使用 M2e eclipse 插件。 并且你必须在你的 POM 中设置这个包装:

    <packaging>bundle</packaging>
    

    【讨论】:

    • 包装很好,但不知何故我的 pom.xml 在这里粘贴后丢失了几行:(。我会用 m2e 插件尝试你的建议。
    猜你喜欢
    • 1970-01-01
    • 2020-06-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-12-15
    • 2011-09-12
    • 2013-02-10
    • 2016-07-20
    相关资源
    最近更新 更多