Hello.

I'm converting a project from an Ant build system to one that uses
Maven instead. The Ant task that created the jar file for the project
defined Section elements in the produced jar:

      <manifest>
        <attribute name="Built-By" value="${user.name}"/>
        <attribute name="Specification-Title"    value="XOM"/>
        <attribute name="Specification-Version"  value="${version}"/>
        <attribute name="Specification-Vendor"   value="Elliotte Rusty Harold"/>
        <attribute name="Implementation-Title"   value="XOM"/>
        <attribute name="Implementation-Version" value="${version}"/>
        <attribute name="Implementation-Vendor"  value="Elliotte Rusty 
Harold"/>          
        <attribute name="Main-Class" value="nu.xom.Info"/>

        <!-- OSGI Information -->
        <attribute name="Manifest-Version" value="1.0"/>
        <attribute name="Bundle-ManifestVersion" value="2"/>
        <attribute name="Bundle-Name" value="${Name}"/>
        <attribute name="Bundle-SymbolicName" value="nu.xom"/>
        <attribute name="Bundle-Version" value="${bundleversion}"/>
        <attribute name="Bundle-Vendor" value="xom.nu"/>
        <attribute name="Bundle-RequiredExecutionEnvironment" value="J2SE-1.2"/>
        <attribute name="Export-Package" value="nu.xom, nu.xom.canonical, 
nu.xom.converters, nu.xom.xinclude, nu.xom.xslt"/>
        <attribute name="Import-Package" value='javax.xml.transform.sax, 
javax.xml.transform, org.w3c.dom, org.xml.sax, org.xml.sax.helpers, 
org.xml.sax.ext,
          org.apache.xerces.parsers;resolution:=optional;version="2.8.0", 
org.apache.xerces.impl;resolution:=optional;version="2.8.0", 
          org.apache.xerces.jaxp;resolution:=optional;version="2.9.0", 
junit.framework;resolution:=optional;version="3.8.1",
          com.sun.org.apache.xerces.internal.jaxp;resolution:=optional, 
com.sun.org.apache.xerces.internal.parsers;resolution:=optional'/>

        <section name="nu/xom/">
          <attribute name="Sealed" value="true"/>
          <attribute name="Specification-Title"    value="XOM core classes"/>
          <attribute name="Implementation-Title"   value="nu.xom"/>
          <attribute name="Implementation-Version" value="${version}"/>
          <attribute name="Implementation-Vendor"  value="Elliotte Rusty 
Harold"/>          
        </section>
        <section name="nu/xom/xslt/">
          <attribute name="Sealed" value="true"/>
          <attribute name="Specification-Title"   value="XOM XSLT interface"/>
          <attribute name="Implementation-Title"  value="nu.xom.xslt"/>
        </section>
        <section name="nu/xom/xinclude/">
          <attribute name="Sealed" value="true"/>
          <attribute name="Specification-Title"   value="XOM XInclude engine"/>
          <attribute name="Implementation-Title"  value="nu.xom.xinclude"/>
        </section>
        <section name="nu/xom/converters/">
          <attribute name="Sealed" value="true"/>
          <attribute name="Specification-Title"   value="XOM converters to 
other object models"/>
          <attribute name="Implementation-Title"  value="nu.xom.converters"/>
        </section>
        <section name="nu/xom/canonical/">
          <attribute name="Sealed" value="true"/>
          <attribute name="Specification-Title"   value="XOM Canonical XML 
support"/>
          <attribute name="Implementation-Title"  value="nu.xom.canonical"/>
        </section>
      </manifest>

I'm trying to use the maven-bundle-plugin to produce an OSGi bundle as the 
primary
artifact, but want to keep those added sections above for compatibility reasons.

The following configuration doesn't seem to work, however:

     <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>3.2.0</version>
        <extensions>true</extensions>
        <configuration>
          <instructions>
            <Bundle-Vendor>xom.nu</Bundle-Vendor>
            
<Bundle-RequiredExecutionEnvironment>J2SE-1.2</Bundle-RequiredExecutionEnvironment>

            <Specification-Title>XOM</Specification-Title>
            <Specification-Version>${project.version}</Specification-Version>
            <Specification-Vendor>Elliotte Rusty Harold</Specification-Vendor>
            <Implementation-Title>XOM</Implementation-Title>
            <Implementation-Version>${project.version}</Implementation-Version>
            <Implementation-Vendor>Elliotte Rusty Harold</Implementation-Vendor>
            
<Implementation-Vendor-Id>${project.groupId}</Implementation-Vendor-Id>
            <Main-Class>nu.xom.Info</Main-Class>

            <Section name="nu/xom/">
              <Sealed>true</Sealed>
              <Specification-Title>XOM</Specification-Title>
              <Implementation-Title>nu.xom</Implementation-Title>
              
<Implementation-Version>${project.version}</Implementation-Version>
              <Implementation-Vendor>Elliotte Rusty 
Harold</Implementation-Vendor>
            </Section>

            <Section name="nu/xom/xslt">
              <Sealed>true</Sealed>
              <Specification-Title>XOM XSLT interface</Specification-Title>
              <Implementation-Title>nu.xom.xslt</Implementation-Title>
            </Section>

            <Section name="nu/xom/xinclude">
              <Sealed>true</Sealed>
              <Specification-Title>XOM XInclude engine</Specification-Title>
              <Implementation-Title>nu.xom.xinclude</Implementation-Title>
            </Section>

            <Section name="nu/xom/converters">
              <Sealed>true</Sealed>
              <Specification-Title>XOM converters to other object 
models</Specification-Title>
              <Implementation-Title>nu.xom.converters</Implementation-Title>
            </Section>

            <Section name="nu/xom/canonical">
              <Sealed>true</Sealed>
              <Specification-Title>XOM Canonical XML 
support</Specification-Title>
              <Implementation-Title>nu.xom.canonical</Implementation-Title>
            </Section>

            <Import-Package>
              com.sun.org.apache.xerces.internal.jaxp;    
resolution:="optional",
              com.sun.org.apache.xerces.internal.parsers; 
resolution:="optional",

              javax.swing;      resolution:="optional",
              javax.swing.tree; resolution:="optional",
              *
            </Import-Package>

            <Export-Package>
              nu.xom,
              nu.xom.canonical,
              nu.xom.converters,
              nu.xom.xinclude,
              nu.xom.xslt
            </Export-Package>
          </instructions>
        </configuration>
      </plugin>

The top-level Specification-Title, Specification-Version, etc elements do 
appear in the
manifest of the produced bundle, but the Section elements are quietly ignored. 
Is
there another way to achieve what I want?

M

Attachment: pgpqYfyHD9YyI.pgp
Description: OpenPGP digital signature

Reply via email to