Maven: Unresolved references to [org.osgi.service.http]

*爱你&永不变心* 提交于 2019-12-04 04:04:29

In the configuration of the maven-bundle-plugin you have to specify all the packages you need to import.

In your case it should be:

   <plugin>
    <groupId>org.apache.felix</groupId>
    <artifactId>maven-bundle-plugin</artifactId>
    <extensions>true</extensions>
    <configuration>
     <instructions>
      ...
      <Import-Package>org.osgi.service.http, org.osgi.framework;version="1.0.0", javax.servlet, javax.servlet.http</Import-Package>
     </instructions>
    </configuration>
   </plugin>

The given answer is wrong. You don't need to specify ALL the packages you need to import. Simply put a * at the end of your instruction to import (without version definition) the missing packages:

<Import-Package>org.osgi.framework;version="1.0.0", javax.servlet, javax.servlet.http**,***</Import-Package>

Use the newer bundle version: org.apache.felix maven-bundle-plugin 2.0.0 true

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!