eclipse-ee4j / glassfish-hk2

Dynamic dependency injection framework
https://eclipse-ee4j.github.io/glassfish-hk2
Other
83 stars 55 forks source link

Configure OSGI manifest file for hk2-inhabitant-generator #13

Open glassfishrobot opened 9 years ago

glassfishrobot commented 9 years ago

hi hk2-inhabitant-generator manifest file seem outdated (https://issues.apache.org/jira/browse/FELIX-519) i drop pre-built OSGI manifest file (hk2-inhabitant-generator/src/main/resources/META-INF/MANIFEST.MF) and generated a new one with:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jar-plugin</artifactId>
    <version>2.4</version>
    <configuration>
    <archive>
        <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
        <manifestEntries>
        <service>foo</service>
        </manifestEntries>
    </archive>
    </configuration>
</plugin>
<plugin>
    <groupId>org.apache.felix</groupId>
    <artifactId>maven-bundle-plugin</artifactId>
    <version>2.3.7</version>
    <configuration>
    <supportedProjectTypes>
        <supportedProjectType>maven-plugin</supportedProjectType>
        <supportedProjectType>jar</supportedProjectType>
        <supportedProjectType>bundle</supportedProjectType>
    </supportedProjectTypes>
    <instructions>
        <Bundle-Description>${project.name}</Bundle-Description>
        <Bundle-Name>${project.name}</Bundle-Name>
        <Bundle-SymbolicName>${project.groupId}.inhabitant-generator</Bundle-SymbolicName>
        <Bundle-Vendor>${project.organization.name}</Bundle-Vendor>
        <Bundle-Version>${project.version}</Bundle-Version>
    </instructions>
    </configuration>
    <executions>
    <execution>
        <id>bundle-manifest</id>
        <phase>process-classes</phase>
        <goals>
        <goal>manifest</goal>
        </goals>
    </execution>
    </executions>
</plugin>
glassfishrobot commented 5 years ago
glassfishrobot commented 9 years ago

@puntogil Commented using org.glassfish.hk2:osgiversion-maven-plugin hk2-inhabitant-generator/osgi.bundle

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jar-plugin</artifactId>
    <version>2.4</version>
    <configuration>
    <archive>
        <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
        <manifestEntries>
               <!-- really necessary? -->
        <service>foo</service>
        </manifestEntries>
    </archive>
    </configuration>
</plugin>
<plugin>
    <groupId>org.glassfish.hk2</groupId>
    <artifactId>osgiversion-maven-plugin</artifactId>
    <version>${project.version}</version>
</plugin>
<plugin>
    <groupId>org.apache.felix</groupId>
    <artifactId>maven-bundle-plugin</artifactId>
    <version>2.3.7</version>
    <configuration>
         <!-- permit to configure OSGi manifest for a maven plugin -->
    <supportedProjectTypes>
        <supportedProjectType>maven-plugin</supportedProjectType>
        <supportedProjectType>jar</supportedProjectType>
        <supportedProjectType>bundle</supportedProjectType>
    </supportedProjectTypes>
    </configuration>
    <executions>
    <execution>
        <id>bundle-manifest</id>
        <phase>process-classes</phase>
        <goals>
        <goal>manifest</goal>
        </goals>
    </execution>
    </executions>
</plugin>

contents of hk2-inhabitant-generator/osgi.bundle

-exportcontents: \
               org.jvnet.hk2.generator; \
               org.jvnet.hk2.generator.maven; \
               version=${project.osgi.version}

result manifest file

Manifest-Version: 1.0
Export-Package: org.jvnet.hk2.generator;uses:="org.glassfish.hk2.utili
 ties.general";version="2.4.0",org.jvnet.hk2.generator.maven;uses:="or
 g.apache.maven.artifact,org.apache.maven.model,org.apache.maven.plugi
 n.logging,org.jvnet.hk2.generator,org.apache.maven.project,org.apache
 .maven.plugin";version="2.4.0"
Built-By: me
Tool: Bnd-1.50.0
Bundle-Name: Inhabitant Generator
Created-By: Apache Maven Bundle Plugin
Bundle-Vendor: Oracle Corporation
Build-Jdk: xxx
Bundle-Version: 2.4.0.b24
service: foo
Bnd-LastModified: 1432794396071
Bundle-ManifestVersion: 2
Bundle-License: https://glassfish.java.net/nonav/public/CDDL+GPL_1_1.h
 tml
Bundle-Description: Inhabitant Generator
Bundle-SymbolicName: org.glassfish.hk2.inhabitant-generator
Bundle-DocURL: http://www.oracle.com
Import-Package: javax.inject;version="[1.0,2)",org.apache.maven.artifa
 ct,org.apache.maven.model,org.apache.maven.plugin,org.apache.maven.pl
 ugin.logging,org.apache.maven.project,org.apache.tools.ant,org.apache
 .tools.ant.types,org.glassfish.hk2.api;version="[2.4,3)",org.glassfis
 h.hk2.utilities;version="[2.4,3)",org.glassfish.hk2.utilities.general
 ;version="[2.4,3)",org.glassfish.hk2.utilities.reflection;version="[2
 .4,3)",org.jvnet.hk2.annotations;version="[2.4,3)",org.objectweb.asm;
 version="[5.0,6)"
Archiver-Version: Plexus Archiver