Uploaded image for project: 'Velocity'
  1. Velocity
  2. VELOCITY-768

Mark optional dependencies as optional in OSGi bundle manifest

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0
    • 1.7
    • Build
    • None

    Description

      Trying to use the Velocity 1.7-beta1 JAR in our OSGi container (Felix running in Atlassian Confluence), we ran into dependency problems because all the dependencies of Velocity are marked as mandatory.

      As you would know, Velocity has a logging abstraction which allows different logging frameworks to be used. Likewise, you don't need the servlet API to use Velocity. However, these dependencies are marked as required in the new OSGi manifest added in VELOCITY-694. This causes the bundle to fail to start because the dependencies are missing.

      From our testing, we could use Velocity in our application just fine with following imports changed to be optional:

      • com.werken.xpath
      • javax.servlet
      • javax.servlet.http
      • org.apache.commons.logging
      • org.apache.log
      • org.apache.log.format
      • org.apache.log.output.io
      • org.apache.log4j
      • org.apache.oro.text.perl
      • org.apache.tools.ant
      • org.apache.tools.ant.taskdefs
      • org.jdom
      • org.jdom.input
      • org.jdom.output

      That means changing the current Import-Package declaration from this:

      Import-Package: com.werken.xpath,
      javax.naming,
      javax.servlet,
      javax.servlet.http,
      javax.sql,
      org.apache.commons.collections,
      org.apache.commons.collections.map,
      org.apache.commons.lang,
      org.apache.commons.lang.builder,
      org.apache.commons.lang.text,
      org.apache.commons.logging,
      org.apache.log,
      org.apache.log.format,
      org.apache.log.output.io,
      org.apache.log4j,
      org.apache.oro.text.perl,
      org.apache.tools.ant,
      org.apache.tools.ant.taskdefs,
      org.jdom,
      org.jdom.input,
      org.jdom.output,
      org.xml.sax

      to this:

      Import-Package: com.werken.xpath;resolution:=optional,
      javax.naming,
      javax.servlet;resolution:=optional,
      javax.servlet.http;resolution:=optional,
      javax.sql,
      org.apache.commons.collections,
      org.apache.commons.collections.map,
      org.apache.commons.lang,
      org.apache.commons.lang.builder,
      org.apache.commons.lang.text,
      org.apache.commons.logging;resolution:=optional,
      org.apache.log;resolution:=optional,
      org.apache.log.format;resolution:=optional,
      org.apache.log.output.io;resolution:=optional,
      org.apache.log4j;resolution:=optional,
      org.apache.oro.text.perl;resolution:=optional,
      org.apache.tools.ant;resolution:=optional,
      org.apache.tools.ant.taskdefs;resolution:=optional,
      org.jdom;resolution:=optional,
      org.jdom.input;resolution:=optional,
      org.jdom.output;resolution:=optional,
      org.xml.sax

      I'll prepare a patch against trunk and attach it shortly.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              mjryall Matt Ryall
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: