Menu

#13 Add some lines to jar manifest for OSGI

closed
nobody
None
5
2012-10-30
2011-12-16
No

Please add the following lines to the MANIFEST.MF file to make the jar OSGI aware:

Bundle-Version: 3.2.0
Bundle-Name: Jericho html parser
Export-Package: net.htmlparser.jericho;version="3.2.0",net.htmlparser.jericho.nodoc;version="3.2.0"
Import-Package: org.slf4j.impl;version="[1.6.1,2.0.0)"

If the build is done with maven, see for example http://maven.apache.org/plugins/maven-jar-plugin/examples/manifest-customization.html

Thanks!

Discussion

  • Erik van Oosten

    Erik van Oosten - 2011-12-16

    Correction. The additional headers should be:

    Export-Package: net.htmlparser.jericho;version="3.2.0";uses:="org.slf4j,org.slf4j.impl",net.htmlparser.jericho.nodoc;version="3.2.0";uses:="org.slf4j,org.slf4j.impl"
    Bundle-Version: 3.2.0
    Bundle-Name: Jericho html parser
    Bundle-ManifestVersion: 2
    Import-Package: org.slf4j;version="[1.6.1,1.7.0)",org.slf4j.impl;version="[1.6.1,2.0.0)"

     
  • Erik van Oosten

    Erik van Oosten - 2011-12-20

    Sorry to keep spamming. Here are correct lines for the MANIFEST.MF.. This time it is realy tested :)

    Export-Package: net.htmlparser.jericho;version="3.2.0";uses:="org.slf4j,org.slf4j.impl",net.htmlparser.jericho.nodoc;version="3.2.0";uses:="org.slf4j,org.slf4j.impl"
    Bundle-Name: Jericho html parser
    Bundle-ManifestVersion: 2
    Bundle-SymbolicName: net.htmlparser.jericho
    Bundle-Vendor: Jericho
    Bundle-Version: 3.2.0
    Import-Package: org.slf4j;version="[1.6.1,1.7.0)",org.slf4j.impl;version="[1.6.1,2.0.0)"

     
  • Martin Jericho

    Martin Jericho - 2011-12-22

    Thanks Erik, I will look into this for the next release.

     
  • Martin Jericho

    Martin Jericho - 2012-10-29

    Hi Erik,

    It's time for me to do an official release soon, and this was on my todo list.

    While it might be ideal for the jar to contain an OSGI manifest, I'm not sure it's really going to help anyone, and I don't really want to read through all the OSGI specs to make sure I do it properly.

    Your latest post contains errors, such as:
    - truncated Export-Package line
    - doesn't specify that slf4j is optional
    - doesn't mention any of the other optional dependencies
    - lines exceeding 72 characters

    It also includes net.htmlparser.jericho.nodoc in the export which I suspect is unnecesary as it is only used internally, but I'm not sure and it would take me some time to find out whether it is required or not.

    I don't have the time to ensure the manifest is error free, so I'd rather leave it out. Considering this library does not have any mandatory dependencies I'm not sure there is much advantage including an OSGI manifest.

    If you can convince me it is really necessary, and you or someone else could attach the complete manifest file guaranteed to be correct, I'll consider including it.

    Please respond within the next few days if you'd like to assist further.

    Thanks
    Martin

     
  • Erik van Oosten

    Erik van Oosten - 2012-10-30

    Hi Martin,

    Thanks for looking into this. Let me address your concerns:

    > - truncated Export-Package line
    This is because of this forum limitations. Just put the lines together with a space as separator.

    > - doesn't specify that slf4j is optional
    Indeed. It doesn't make sense to use anything else but slf4j in an OSGI context. That's why I made it required.

    By the way, IMHO it doesn't make sense to support multiple logging frameworks at all. All the big logging frameworks can easily be mapped to each other. If you need advice, Slf4j seems to be most flexible and safe choice currently.

    > - doesn't mention any of the other optional dependencies
    That could be a problem (unless they are all for logging). What are those dependencies?

    > - lines exceeding 72 characters
    That's okay, the 'jar' tool will correct that (provided you use the -m option).

    I no longer need the OSGI bundle as the only product that uses it here was rewritten from the ground up without OSGI. So personally I don't care if you will not include OSGI support ;)

    Kind regards,
    Erik.

    --
    Erik van Oosten
    http://www.day-to-day-stuff.blogspot.com

     
  • Martin Jericho

    Martin Jericho - 2012-10-30

    Not implementing in release 3.3 due to the effort required to ensure it is done correctly. Will condider it in a future release if there is demand.

    To anyone who would like it implemented please re-open this feature request.

     
  • Martin Jericho

    Martin Jericho - 2012-10-30
    • status: open --> closed
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.