当前位置: 首页 > 知识库问答 >
问题:

捆绑包中未解析的约束osgi.wiring.package=com.mashape.unirest。http(版本>=2.0.0)(!(版本>=3.0.1))

太叔烨霖
2023-03-14

我正在尝试在fuse服务器上部署一个捆绑包,但对其进行了一些更改。我添加了unirest依赖项来执行REST调用

该版本在本地计算机和 Jenkins 上工作正常,但捆绑包会引发错误,并且无法在 fuse 服务器上部署。

它抛出以下错误:

Unable to start bundle 3716: 
  unresolved constraint in bundle com.......component.sharepoint [3716] :
   unable to resolve 3761.0 :
     missing  requirment (3761.0 ) (&(osgi.wiring.package;(&(osgi.wiring.package=com.mashape.unirest.http)(version>=2.0.0)(!(version>=3.0.0)))

以下是我的pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>******confidential****</groupId>
        <artifactId>parent</artifactId>
        <version>2.0.0-SNAPSHOT</version>
        <relativePath>../parent</relativePath>
    </parent>

    <artifactId>sharepoint</artifactId>
    <packaging>bundle</packaging>

    <name>Fuse : Component : SharePoint</name>
    <url>******</url>

    <dependencies>
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>${commons.coded.version}</version>
        </dependency>

        <dependency>
            <groupId>***************</groupId>
            <artifactId>vendorcache</artifactId>
            <version>${vendorcache.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-io</artifactId>
            <version>${commons-io.version}</version>
        </dependency>
        
        <dependency>
            <groupId>com.mashape.unirest</groupId>
            <artifactId>unirest-java</artifactId>
            <version>1.4.9</version>
        </dependency>
    </dependencies>
    
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>${maven-bundle-plugin.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Bundle-SymbolicName>${project.parent.groupId}.${project.artifactId}</Bundle-SymbolicName>
                        <Bundle-Name>${project.parent.groupId}.${project.artifactId}</Bundle-Name>
                        <Export-Package>
                            ${project.parent.groupId}.${project.artifactId}.*
                        </Export-Package>
                        <Import-Package>*</Import-Package>
                        <Embed-Dependency>com.mashape.unirest;scope=compile|runtime;inline=true</Embed-Dependency>
                        <Embed-Transitive>true</Embed-Transitive>
                    </instructions>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

共有1个答案

刁茂才
2023-03-14

在我的pom中添加以下内容.xml对我有用:

把它包括在建筑中-

 <plugin>
    <groupId>org.apache.felix</groupId>
    <artifactId>maven-bundle-plugin</artifactId>
    <extensions>true</extensions>
    <configuration>
      <instructions>
        <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
        <Import-Package>*</Import-Package>
      </instructions>
    </configuration>
  </plugin>
 类似资料: