lz4 / lz4-java

LZ4 compression for Java
Apache License 2.0
1.1k stars 253 forks source link

Make the POM generate an OSGi compliant manifest #30

Closed tarelli closed 7 years ago

tarelli commented 10 years ago

It would be nice if the POM could be extended to generate an OSGi compliant manifest file. The result of including this is that the library could then be used in OSGi containers. This can be easily done adding to the pom something like this:

            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>2.3.7</version>
                <extensions>true</extensions>
                <configuration>
                    <manifestLocation>src/main/java/META-INF</manifestLocation>
                    <supportedProjectTypes>
                        <supportedProjectType>jar</supportedProjectType>
                        <supportedProjectType>bundle</supportedProjectType>
                    </supportedProjectTypes>
                    <instructions>
                        <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
                        <Bundle-Version>${project.version}</Bundle-Version>
                        <Bundle-ClassPath>.,{maven-dependencies}</Bundle-ClassPath>
                    </instructions>
                </configuration>
            </plugin>
jpountz commented 10 years ago

Hey Matteo, thanks for opening this issue!

I don't know anything about OSGI but I'd be happy to make lz4 easier to use from OSGI containers. You gave instructions for Maven but I think they should be pretty easy to translate to Ant (which lz4-java is using right now). What I'm unsure about is if there are restrictions when linking to native libraries from an OSGI container?

tarelli commented 10 years ago

Hi Adrien, I use other OSGi bundles which use native libraries and that it's not a problem. My problem is that I don't have expertise with Ivy and although I already spent a couple of hours I haven't managed yet to get Ant to generate a bundle which has a manifest file with OSGi information (Import/Export of packages).

jpountz commented 10 years ago

This library doesn't have any dependency (besides Junit, but it is used only for tests) so I don't think you need to worry about Ivy? Regarding the manifest, Ant's jar task has an option to add a manifest to the jar file, maybe we could use it to declare the import/export of packages?

tarelli commented 10 years ago

@jpountz Hi Adrien, did you have any chance of looking at this? Also another question: do you have any experience decoding something compressed with your Java LZ4 implementation in Javascript? I tried this but I can't manage, could you easily tell by any chance if the two implementations are compatible? Thanks!

magnet commented 10 years ago

Proposed fix in pull-req #39

avianey commented 9 years ago

any new about this ? does the jar generated by ant contain the MANIFEST.MF with OSGI informations ? The latest release in maven central does not...

jwcarman commented 8 years ago

If you would like, I can provide a patch for this. It's pretty simple to add in the maven-bundle-plugin with default settings to make this work.

odaira commented 7 years ago

The fix by #39 was already merged in the lz4-java 1.3.0 release, so I can close this issue, can't I?

magnet commented 7 years ago

@odaira yes :)

odaira commented 7 years ago

Thanks!