<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>bnd Import-Package</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=111638220" />
  <subtitle>bnd Import-Package</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=111638220</id>
  <updated>2026-04-06T20:18:31Z</updated>
  <dc:date>2026-04-06T20:18:31Z</dc:date>
  <entry>
    <title>RE: bnd Import-Package</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111681056" />
    <author>
      <name>Andrew Jardine</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111681056</id>
    <updated>2018-11-27T15:43:07Z</updated>
    <published>2018-11-27T15:43:07Z</published>
    <summary type="html">&lt;p&gt;Hi Omar, &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;I am 100% inline with Patrick's comment. I have a couple doizen
  service builder modules across various projects and I have never had
  to import the kernel dependencies (in 7.1 or in 7.0 for that matter).
  I did have a similar issue recently and the solutionf or me was just
  as Patrick said, using the Import-Package statement in the BND and
  _NOT FORGETTING TO ADD_ the * at the end. I had forgotten that very
  important part which made a mess during deployment and I had piles of
  &amp;quot;NoClassDefFound&amp;quot; exceptions showing up in my log.&lt;/p&gt;</summary>
    <dc:creator>Andrew Jardine</dc:creator>
    <dc:date>2018-11-27T15:43:07Z</dc:date>
  </entry>
  <entry>
    <title>RE: bnd Import-Package</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111676909" />
    <author>
      <name>Patrick Conley</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111676909</id>
    <updated>2018-11-26T22:49:01Z</updated>
    <published>2018-11-26T22:49:01Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;p&gt;Omar, most (all?) of the packages you've listed in your
  Import-Package header&amp;nbsp;are redundant. Usually, you only need to list
  packages if their code is loaded by reflection (using
  &lt;code&gt;Class.forName&lt;/code&gt; or similar); bnd will automatically add any
  packages loaded through &lt;code&gt;import&lt;/code&gt; statements, unless you
  override that behaviour (as you've done).&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;From comparing your bnd.bnd with one of mine, my guess is that
  &lt;code&gt;javax.net.ssl&lt;/code&gt;, &lt;code&gt;javax.xml.parsers&lt;/code&gt;, and
  &lt;code&gt;org.xml.sax&lt;/code&gt; are the only packages that need to be listed
  in Import-Package. Add those, and end the list with &lt;code&gt;*&lt;/code&gt;&amp;nbsp;so
  bnd will generate the remainder:&lt;/p&gt;
&lt;pre&gt;
Import-Package: \
&amp;nbsp;   javax.net.ssl,\
&amp;nbsp;   javax.xml.parsers,\
&amp;nbsp;   org.xml.sax,\
&amp;nbsp;   *
&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you add that and still have bundle resolution errors at runtime,
  you may need to add &lt;em&gt;some&lt;/em&gt; more packages. Make sure to keep the &lt;code&gt;*&lt;/code&gt;.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>Patrick Conley</dc:creator>
    <dc:date>2018-11-26T22:49:01Z</dc:date>
  </entry>
  <entry>
    <title>RE: bnd Import-Package</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111670367" />
    <author>
      <name>omar harrari</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111670367</id>
    <updated>2018-11-26T13:27:24Z</updated>
    <published>2018-11-26T13:27:24Z</published>
    <summary type="html">&lt;p&gt;hi &lt;span style="color: inherit;font-family: inherit;font-size: 14.0px;"&gt;Andrew,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;thanks for replying , i'm working on a plugin (for liferay 7.1 CE/DXP
  ) that forward Audit Messages to a Splunk Server , this the code https://github.com/Ajizan/liferay-splunk&lt;/p&gt;
&lt;p&gt;and the bnd.bnd file https://github.com/Ajizan/liferay-splunk/blob/master/liferay-splunk-service/bnd.bnd &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;:) &lt;/p&gt;</summary>
    <dc:creator>omar harrari</dc:creator>
    <dc:date>2018-11-26T13:27:24Z</dc:date>
  </entry>
  <entry>
    <title>RE: bnd Import-Package</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111639080" />
    <author>
      <name>Andrew Jardine</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111639080</id>
    <updated>2018-11-22T15:47:55Z</updated>
    <published>2018-11-22T15:47:55Z</published>
    <summary type="html">&lt;p&gt;Hi Omar, &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Sadly, sometimes it is a necessary evil. I guess you could call it
  one of the &amp;quot;downsides&amp;quot; of OSGI. I have in the past used an
  inverted scenario where I specify the package NOT to include, rather
  than the ones to include -- maybe that would help?&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;With all that said, I am not sure why you aer needingto import the
  com.liferay.portal.kernel. Those classes are already exported and
  available in the OSGI container. Can you share you code with us and
  maybe a little more detail around what you are doing? Perhaps we can
  offer an alternative that doesn't require the import.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Also -- I am assuming this is for 7.0? (or is it 7.1?)&lt;/p&gt;</summary>
    <dc:creator>Andrew Jardine</dc:creator>
    <dc:date>2018-11-22T15:47:55Z</dc:date>
  </entry>
  <entry>
    <title>bnd Import-Package</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111638219" />
    <author>
      <name>omar harrari</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111638219</id>
    <updated>2018-11-22T11:17:51Z</updated>
    <published>2018-11-22T11:17:51Z</published>
    <summary type="html">&lt;p&gt;hi team ,&lt;/p&gt;
&lt;p&gt;i'm working on a service builder and for many dev  reasons i neet to
  import some packages like , &lt;/p&gt;
&lt;p&gt;- com.liferay.portal.kernel &lt;/p&gt;
&lt;p&gt;- org.osgi.framework&lt;/p&gt;
&lt;p&gt;- com.liferay.portal.kernel.exception&lt;/p&gt;
&lt;p&gt;..... etc &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;so I added the dependencies to build. grade, my project has been
  compiled successfully, but it's not deployed, and after some
  search I find that I need to import the packages in my bnd. bnd and it works!&lt;/p&gt;
&lt;p&gt;so my question is : there is any way to make it work without adding
  the packages to bnd.bnd / Import-Package cuz my liste of packages
  become very long , and i'm wondering if there is any good solution for that &lt;/p&gt;</summary>
    <dc:creator>omar harrari</dc:creator>
    <dc:date>2018-11-22T11:17:51Z</dc:date>
  </entry>
</feed>
