title: Karaf / Maven - Unable to resolve: missing requirement osgi.wiring.package
body: <p>I am unable to start a bundle in Karaf (version 3.0.1).</p>
  
  <p>The bundle is built using maven and it imports <a href="http://mvnrepository.com/artifact/com.google.code.gson/gson/2.3.1">gson</a>.</p>
  
  <p>I included gson in maven as required:</p>
  
  <pre><code>&lt;dependency&gt;
       &lt;groupId&gt;com.google.code.gson&lt;/groupId&gt;
       &lt;artifactId&gt;gson&lt;/artifactId&gt;
       &lt;version&gt;2.3.1&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>The build goes fine. However, when deploying the bundle I receive this Warning from Karaf:</p>
  
  <pre><code>2015-05-27 12:45:07,371 | WARN  | 49-19-bin/deploy | fileinstall                      | 11 - org.apache.felix.fileinstall - 3.2.8 | Error while starting bundle: file:/Users/user/Documents/tools/MyBundle-1.0.0-SNAPSHOT.jar
  org.osgi.framework.BundleException: Unresolved constraint in bundle MyBundle [121]: Unable to resolve 121.13: missing requirement [121.13] osgi.wiring.package; (&amp;(osgi.wiring.package=com.google.gson)(version&gt;=2.3.0)(!(version&gt;=3.0.0)))
  at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3974)[org.apache.felix.framework-4.2.1.jar:]
  at org.apache.felix.framework.Felix.startBundle(Felix.java:2037)[org.apache.felix.framework-4.2.1.jar:]
  at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:955)[org.apache.felix.framework-4.2.1.jar:]
  at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1263)[11:org.apache.felix.fileinstall:3.2.8]
  at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1235)[11:org.apache.felix.fileinstall:3.2.8]
  at org.apache.felix.fileinstall.internal.DirectoryWatcher.startAllBundles(DirectoryWatcher.java:1224)[11:org.apache.felix.fileinstall:3.2.8]
  at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:519)[11:org.apache.felix.fileinstall:3.2.8]
  at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:308)[11:org.apache.felix.fileinstall:3.2.8]
  </code></pre>
  
  <p>The bundle is not installed.</p>
  
  <p>The <code>Import-Package</code> in the <code>MANIFEST.MF</code> begins with:</p>
  
  <pre><code>Import-Package: com.google.gson;version="[2.3,3)"
  </code></pre>
  
  <p>I tried to change it with:</p>
  
  <pre><code>Import-Package: com.google.code.gson;version="[2.3,3)"
  </code></pre>
  
  <p>But it gives me a similar error:</p>
  
  <pre><code>missing requirement [121.13] osgi.wiring.package; (&amp;(osgi.wiring.package=com.google.code.gson)
  </code></pre>
  
  <p>The <code>pom.xml</code>:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;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"&gt;
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
  &lt;parent&gt;
      &lt;groupId&gt;groupid&lt;/groupId&gt;
      &lt;artifactId&gt;artifactid&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  &lt;/parent&gt;
  
  &lt;groupId&gt;groupid&lt;/groupId&gt;
  &lt;artifactId&gt;MyBundle&lt;/artifactId&gt;
  &lt;version&gt;1.0.0-SNAPSHOT&lt;/version&gt;
  
  &lt;packaging&gt;bundle&lt;/packaging&gt;
  
  &lt;name&gt;MyBundle&lt;/name&gt;
  &lt;description&gt;MyBundle&lt;/description&gt;
  
  &lt;properties&gt;
      &lt;skipTests&gt;true&lt;/skipTests&gt;
  &lt;/properties&gt;
  
  &lt;dependencies&gt;
      ...
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.felix&lt;/groupId&gt;
          &lt;artifactId&gt;org.apache.felix.http.jetty&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.json&lt;/groupId&gt;
          &lt;artifactId&gt;com.springsource.org.json&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.servicemix.bundles&lt;/groupId&gt;
          &lt;artifactId&gt;org.apache.servicemix.bundles.commons-httpclient&lt;/artifactId&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.postgresql&lt;/groupId&gt;
          &lt;artifactId&gt;postgresql&lt;/artifactId&gt;
          &lt;version&gt;9.4-1201-jdbc41&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.google.code.gson&lt;/groupId&gt;
          &lt;artifactId&gt;gson&lt;/artifactId&gt;
          &lt;version&gt;2.3.1&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;commons-codec&lt;/groupId&gt;
          &lt;artifactId&gt;commons-codec&lt;/artifactId&gt;
          &lt;version&gt;1.10&lt;/version&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  
  &lt;build&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.felix&lt;/groupId&gt;
              &lt;artifactId&gt;maven-bundle-plugin&lt;/artifactId&gt;
              &lt;extensions&gt;true&lt;/extensions&gt;
              &lt;configuration&gt;
                  &lt;instructions&gt;
                      &lt;Bundle-SymbolicName&gt;${project.artifactId}&lt;/Bundle-SymbolicName&gt;
                  &lt;/instructions&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
            &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
              &lt;configuration&gt;
                    &lt;skipTests&gt;${skipTests}&lt;/skipTests&gt;
              &lt;/configuration&gt;
            &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>The <code>MANIFEST.MF</code> of Google GSON (the version maven downloads when I build the bundle) is:</p>
  
  <pre><code>Manifest-Version: 1.0
  Export-Package: com.google.gson;version=2.3.1, com.google.gson.annotat
   ions;version=2.3.1, com.google.gson.reflect;version=2.3.1, com.google
   .gson.stream;version=2.3.1, com.google.gson.internal;version=2.3.1, c
   om.google.gson.internal.bind;version=2.3.1
  Bundle-ClassPath: .
  Built-By: inder
  Bundle-Name: Gson
  Created-By: Apache Maven 3.2.1
  Bundle-RequiredExecutionEnvironment: J2SE-1.5, JavaSE-1.6, JavaSE-1.7,
    JavaSE-1.8
  Bundle-Vendor: Google Gson Project
  Bundle-ContactAddress: http://code.google.com/p/google-gson/
  Build-Jdk: 1.6.0_65
  Bundle-Version: 2.3.1
  Bundle-ManifestVersion: 2
  Bundle-Description: Google Gson library
  Bundle-SymbolicName: com.google.gson
  Archiver-Version: Plexus Archiver
  </code></pre>
  
  <p>I also tried with</p>
  
  <pre><code>&lt;build&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.felix&lt;/groupId&gt;
              &lt;artifactId&gt;maven-bundle-plugin&lt;/artifactId&gt;
              &lt;extensions&gt;true&lt;/extensions&gt;
              &lt;configuration&gt;
                  &lt;instructions&gt;
                      &lt;Bundle-SymbolicName&gt;${project.artifactId}&lt;/Bundle-SymbolicName&gt;
                      &lt;Import-Package&gt;*;resolution:=optional&lt;/Import-Package&gt;
                      &lt;Embed-Dependency&gt;*&lt;/Embed-Dependency&gt;
                      &lt;Embed-Transitive&gt;true&lt;/Embed-Transitive&gt;
                  &lt;/instructions&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
            &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
              &lt;configuration&gt;
                  &lt;skipTests&gt;${skipTests}&lt;/skipTests&gt;
              &lt;/configuration&gt;
            &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  </code></pre>
  
  <p>Now the dependencies are embedded but Karaf cannot start the bundle.</p>