java - Apache ServiceMix 安装 bundle OSGI

标签 java maven osgi apache-karaf apache-servicemix

当我尝试将 bundle 安装到 apache ServiceMix 时收到此消息:

Error executing command: Error installing bundles: Unable to start bundle mvn:org.apache.karaf.shell/shell-sample/1.0-SNAPSHOT: Unresolved cons traint in bundle shell-sample [235]: Unable to resolve 235.0: missing requirement [235.0] osgi.ee; ( &(osgi.ee=JavaSE)(version=1.8))

这是我的命令:

osgi:install -s mvn:org.apache.karaf.shell/shell-sample/1.0-SNAPSHOT

我不明白这个,谷歌无法给我答案

这是我的 pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.apache.karaf.shell</groupId>
  <artifactId>shell-sample</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>bundle</packaging>
  <name>shell-sample</name>
  <url>http://maven.apache.org</url>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.servicemix.specs</groupId>
        <artifactId>org.apache.servicemix.specs.jsr311-api-1.1.1</artifactId>
        <version>2.4.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.servicemix.specs</groupId>
        <artifactId>org.apache.servicemix.specs.jaxb-api-2.2</artifactId>
        <version>2.4.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.servicemix.bundles</groupId>
        <artifactId>org.apache.servicemix.bundles.commons-httpclient</artifactId>
        <version>3.1_7</version>
    </dependency>
  </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <target>1.8</target>
                    <source>1.8</source>
                </configuration>
                <extensions>true</extensions>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <configuration>
                    <instructions>
                        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
                        <Bundle-Description>${project.description}</Bundle-Description>
                        <Import-Package>
                            javax.wsdl,
                            javax.xml.bind,
                            javax.xml.bind.annotation,
                            javax.ws.rs,
                            javax.ws.rs.core,
                            org.springframework.beans.factory.config,
                            org.apache.commons.httpclient,
                            org.apache.commons.httpclient.methods
                        </Import-Package>
                        <Export-Package>
                            org.apache.karaf.shell.cxf.jaxrs
                        </Export-Package>
                    </instructions>
                    <target>1.8</target>
                    <source>1.8</source>
                </configuration>
            <version>2.5.3</version>
            <extensions>true</extensions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.3.2</version>
                <configuration>
                    <mainClass>org.apache.karaf.shell.Service</mainClass>
                    <includePluginDependencies>false</includePluginDependencies>
                    <target>1.8</target>
                    <source>1.8</source>
                </configuration>
                <extensions>true</extensions>
            </plugin>
        </plugins>
    </build>
</project>

我尝试将 java 版本更改为 1.5、1.6、1.7,但与其他 java SE 版本仍然出现相同的错误

我正在使用 Eclipse Luna Java EE

最佳答案

osgi.ee 要求是在 Maven 捆绑插件 2.5.0 中引入的。因此,摆脱它的最简单方法是降级到捆绑插件 2.4。

要更改需求中引用的 java 语言版本,您必须使用 maven-compiler-plugin 并在那里设置目标和源参数。您无法更改 maven 捆绑插件配置中的 java 版本。

关于java - Apache ServiceMix 安装 bundle OSGI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26233077/

相关文章:

java - 制作绘图应用程序的屏幕截图 + 绘制 2D 形状的轮廓

java - 如何让 log4j 与 jetty 一起工作?

java - Maven - 在 jar 中包含引用的库

java - 如何将 Java 应用程序捆绑到 Gnome/Ubuntu 中的关联 .desktop 文件?

java - java中的ClassCastException

java - 在 Hadoop 2 中从 Java 远程读取 HDFS 文件时出现 BlockMissingException

java - 从命令行使用依赖项运行 maven 项目

android - 我如何跳过除 Android 之外的所有目标,以便将多平台 Kotlin 库发布到 maven?

Spring配置来加载bundle中的资源

java - OSGI - 跨包的静态方法调用