Skip to content

[feature request] Support packaging as an OSGi bundle #15

Closed

Description

@Andrew-Cottrell

I suspect the following would need to be changed/added in the POM

<project>
	<packaging>bundle</packaging>

	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.felix</groupId>
				<artifactId>maven-bundle-plugin</artifactId>
				<version>4.1.0</version>
				<extensions>true</extensions>
			</plugin>
		</plugins>
	</build>
</project>

Activity

  1. added
    enhancement
    on Apr 4, 2019
  2. patrickfav commented on Apr 4, 2019

    @patrickfav
    Owner

    Hi,

    As I do not use OSGi I'm not fully comfortable maintaining it. How does this work? Does it create a new OSGi compatible jar? Is it the same jar? Is there no easy way to wrap jars to make them OSGi compatible (outside of this project)?

  3. Andrew-Cottrell commented on Apr 11, 2019

    @Andrew-Cottrell
    Author

    Hi patrickfav

    Yes, it creates an OSGi compatible jar and it's the same jar. The jar should be exactly the same as before, other than additions to META-INF/MANIFEST.MF. It is easy to wrap jars; however, this makes them much harder to use: can't simply add the dependency to a project's pom.xml.

    FYI, another BCrypt implementation does this
    https://github.com/svenkubiak/jBCrypt/commit/89da34b2f779d4d51ff84fdb869273ec8c244de9
    https://github.com/svenkubiak/jBCrypt/blob/0.4.1/pom.xml
    https://mvnrepository.com/artifact/de.svenkubiak/jBCrypt/0.4.1

  4. patrickfav commented on Apr 11, 2019

    @patrickfav
    Owner

    Alright, let me look into this, if the change is transparent for anybody that does not use OSGi then thats fine for me.

  5. added this to the v0.8.0 milestone on Apr 11, 2019
  6. Andrew-Cottrell commented on Apr 11, 2019

    @Andrew-Cottrell
    Author

    Yes, the change should be transparent for non-OSGi uses. Thanks for looking in to this.

  7. added a commit that references this issue on Apr 12, 2019
  8. patrickfav commented on Apr 12, 2019

    @patrickfav
    Owner

    Hi,

    I've pushed the changes to this feature branch: https://github.com/patrickfav/bcrypt/tree/feat-15-osgi

    Could you please checkout, in the root directory run

    ./mvnw clean install
    

    to install the snapshot version into your local repo and change your dependency to

        <dependency>
            <groupId>at.favre.lib</groupId>
            <artifactId>bcrypt</artifactId>
            <version>0.8.0-SNAPSHOT</version>
        </dependency>
    

    and give me feedback if that works? I have no osgi project to test it on (and to be frank never used it before) :)

    Cheers!

  9. Andrew-Cottrell commented on Apr 15, 2019

    @Andrew-Cottrell
    Author

    Hi

    Looks like at.favre.lib:bcrypt is perfect. I was able to build and install the bcrypt-feat-15-osgi modules using Maven, and then to deploy and depend upon the bcrypt module as an OSGi bundle.

    Import-Package: at.favre.lib.crypto.bcrypt;version="[0.8.0,0.9.0)"

    But it's only partly working as there is a dependency on at.favre.lib:bytes, which is not currently OSGi compatible. Without at.favre.lib:bytes also being an OSGi bundle it doesn't work at runtime.

    Cheers!

  10. Andrew-Cottrell commented on Apr 15, 2019

    @Andrew-Cottrell
    Author

    (sorry, didn't mean to close)

  11. patrickfav commented on Apr 15, 2019

    @patrickfav
    Owner

    Hi, I've released a new bytes version with also OSGi support. For now the support is added, but I can't guarantee it for the lifetime of this project as the requirement that every transitive dependency must ALSO be OSGi compatible makes it quite restricting.

    I'm soon releasing 0.8.0 - please leave me a line to tell me if the lib now works with your project.

  12. patrickfav commented on Apr 16, 2019

    @patrickfav
    Owner

    Released.

  13. Andrew-Cottrell commented on Apr 24, 2019

    @Andrew-Cottrell
    Author

    BCrypt 0.8.0 (and Bytes 1.1.0) works great with my projects. Thanks for adding OSGi support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions