{"action":"created","issue":{"url":"https://api.github.com/repos/cache2k/cache2k/issues/27","labels_url":"https://api.github.com/repos/cache2k/cache2k/issues/27/labels{/name}","comments_url":"https://api.github.com/repos/cache2k/cache2k/issues/27/comments","events_url":"https://api.github.com/repos/cache2k/cache2k/issues/27/events","html_url":"https://github.com/cache2k/cache2k/issues/27","id":124678384,"number":27,"title":"OSGi support","user":{"login":"joebrassi","id":11758759,"avatar_url":"https://avatars.githubusercontent.com/u/11758759?v=3","gravatar_id":"","url":"https://api.github.com/users/joebrassi","html_url":"https://github.com/joebrassi","followers_url":"https://api.github.com/users/joebrassi/followers","following_url":"https://api.github.com/users/joebrassi/following{/other_user}","gists_url":"https://api.github.com/users/joebrassi/gists{/gist_id}","starred_url":"https://api.github.com/users/joebrassi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joebrassi/subscriptions","organizations_url":"https://api.github.com/users/joebrassi/orgs","repos_url":"https://api.github.com/users/joebrassi/repos","events_url":"https://api.github.com/users/joebrassi/events{/privacy}","received_events_url":"https://api.github.com/users/joebrassi/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/cache2k/cache2k/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/cache2k/cache2k/milestones/8","html_url":"https://github.com/cache2k/cache2k/milestones/v0.23","labels_url":"https://api.github.com/repos/cache2k/cache2k/milestones/8/labels","id":1481719,"number":8,"title":"v0.23","description":null,"creator":{"login":"cruftex","id":2668191,"avatar_url":"https://avatars.githubusercontent.com/u/2668191?v=3","gravatar_id":"","url":"https://api.github.com/users/cruftex","html_url":"https://github.com/cruftex","followers_url":"https://api.github.com/users/cruftex/followers","following_url":"https://api.github.com/users/cruftex/following{/other_user}","gists_url":"https://api.github.com/users/cruftex/gists{/gist_id}","starred_url":"https://api.github.com/users/cruftex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cruftex/subscriptions","organizations_url":"https://api.github.com/users/cruftex/orgs","repos_url":"https://api.github.com/users/cruftex/repos","events_url":"https://api.github.com/users/cruftex/events{/privacy}","received_events_url":"https://api.github.com/users/cruftex/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":0,"state":"open","created_at":"2016-01-04T07:14:37Z","updated_at":"2016-01-04T07:14:37Z","due_on":null,"closed_at":null},"comments":6,"created_at":"2016-01-03T23:30:30Z","updated_at":"2016-01-10T16:04:46Z","closed_at":null,"body":"The current version 0.22 is not ready for OSGi environments.\r\n\r\nTo make it ready for OSGi just include the maven plugin\r\n```xml\r\n<plugin>\r\n  <groupId>org.apache.felix</groupId>\r\n  <artifactId>maven-bundle-plugin</artifactId>\r\n  <version>3.0.1</version>\r\n  <extensions>true</extensions>\r\n</plugin>\r\n```\r\nAnd add the export packages you want to make available for OSGi. [http://felix.apache.org/documentation/subprojects/apache-felix-maven-bundle-plugin-bnd.html](http://felix.apache.org/documentation/subprojects/apache-felix-maven-bundle-plugin-bnd.html)"},"comment":{"url":"https://api.github.com/repos/cache2k/cache2k/issues/comments/170362388","html_url":"https://github.com/cache2k/cache2k/issues/27#issuecomment-170362388","issue_url":"https://api.github.com/repos/cache2k/cache2k/issues/27","id":170362388,"user":{"login":"joebrassi","id":11758759,"avatar_url":"https://avatars.githubusercontent.com/u/11758759?v=3","gravatar_id":"","url":"https://api.github.com/users/joebrassi","html_url":"https://github.com/joebrassi","followers_url":"https://api.github.com/users/joebrassi/followers","following_url":"https://api.github.com/users/joebrassi/following{/other_user}","gists_url":"https://api.github.com/users/joebrassi/gists{/gist_id}","starred_url":"https://api.github.com/users/joebrassi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joebrassi/subscriptions","organizations_url":"https://api.github.com/users/joebrassi/orgs","repos_url":"https://api.github.com/users/joebrassi/repos","events_url":"https://api.github.com/users/joebrassi/events{/privacy}","received_events_url":"https://api.github.com/users/joebrassi/received_events","type":"User","site_admin":false},"created_at":"2016-01-10T16:04:46Z","updated_at":"2016-01-10T16:04:46Z","body":"OK, didn't know that cache2k-api was a separate artifact, I thought you created it only for OSGi. \r\n\r\nRegarding your points:\r\n\r\n1. cache2k-all, that's a good idea.\r\n2. here you may be confused, because an OSGi bundle is a simple jar with (at least) the `Bundle-SymbolicName` entry in the manifest file. So, you just continue building the cache2k as you always have, with the only addition of the `maven-bundle-plugin` configured in your POM, which will only add few additional headers to the manifest, this will make your artifacts (jars) to work in OSGi and non-OSGi environments.\r\n3. Of course, with the correct configuration of `maven-bundle-plugin` you get the OSGi headers.\r\n4. This one can be done too. In fact, you don't have to sacrifice any of your regular headers because of the use of OSGi headers, remember that for the OSGi to recognize any jar file as an OSGi bundle, it only needs the `Bundle-SymbolicName` in its manifest file, that is all, the rest is just going further in the OSGi direction. Here bellow is an example on how you can add some other headers to the manifest manually during the building of your jar/bundle using an external file `osgi.bnd` in the root of your project:\r\n```xml\r\n<plugin>\r\n  <groupId>org.apache.felix</groupId>\r\n  <artifactId>maven-bundle-plugin</artifactId>\r\n  <configuration>\r\n    <instructions>\r\n      <Bundle-SymbolicName>org.cache2k.services</Bundle-SymbolicName>\r\n      <Bundle-Version>0.24.0</Bundle-Version>\r\n      <_include>-osgi.bnd</_include>\r\n    </instructions>\r\n  </configuration>\r\n</plugin>\r\n```\r\nThen you write the file `osgi.bnd` aside of the `pom.xml` with whatever content you want to include or overwrite in your manifest file. For example:\r\n```\r\nBundle-Activator: org.cache2k.internal.Activator\r\nMyHeader:some-value\r\n```\r\nNow, when you build the artifact these headers will be included (or overwritten) in the manifest file by the `maven-bundle-plugin`."}}