Unresolved constraint in bundles-osgi.wiring.package=com.mashape.unirest.http (version>=2.0.0)(!(version>=3.0.0))

147 Views Asked by At

I am trying to deploy a bundle on fuse server after making few changes in it. I have added unirest dependency to perform REST calls.

The build is working fine on local machine and on Jenkins, but the bundle is throwing error and not getting deployed on fuse server.

It is throwing below error:

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

Below is my 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

There are 1 best solutions below

0
Manjeet Suman On

Adding following in my pom.xml worked for me :

Include it under build->plugins.

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