Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic OSGi metadata to the uber-jar #1710

Merged
merged 1 commit into from
Nov 24, 2024

Conversation

laeubi
Copy link
Contributor

@laeubi laeubi commented Nov 24, 2024

Currently the uber-jar is a plain jar and therefore needs to be either wrapped or embedded when using inside OSGi.

This now adds very basic OSGi meta-data so it can be used inside OSGi, possible use-cases are:

  • fetch it bundle location and start lemminx as a CLI process
  • create fragments of the host that export packages, import additional packages or provide extensions
  • create a fragment that provides a Declarative-Service-Component to provide services to other parts of the system
  • ...

@mickaelistria this should make it possible to extract it from WWD as a very first basic step.

Currently the uber-jar is a plain jar and therefore needs to be either
wrapped or embedded when using inside OSGi.

This now adds very basic OSGi meta-data so it can be used inside OSGi,
possible use-cases are:

- fetch it bundle location and start lemminx as a CLI process
- create fragments of the host that export packages, import additional
packages or provide extensions
- create a fragment that provides a Declarative-Service-Component to
provide services to other parts of the system
- ...
This was referenced Nov 24, 2024
@mickaelistria
Copy link
Contributor

Can you please show what the generated MANIFEST looks like?

@laeubi
Copy link
Contributor Author

laeubi commented Nov 24, 2024

The manifest looks like this:

Manifest-Version: 1.0
Bundle-SymbolicName: org.eclipse.lemminx.uber-jar
Bundle-Name: lemminx uber jar bundle
Bundle-Version: 0.28.1.SNAPSHOT
Bundle-ActivationPolicy: lazy
Bundle-ManifestVersion: 2
Bundle-Vendor: Eclipse.org
Service-Component: OSGI-INF/*.xml
Build-Jdk-Spec: 1.8
Created-By: Maven Archiver 3.6.0
Main-Class: org.eclipse.lemminx.XMLServerLauncher

one could of course also check out this PR and see the final result, I also installed the bundle in my m2e dev eclipse and at least it shows up as

444	ACTIVE      org.eclipse.lemminx.uber-jar_0.28.1.SNAPSHOT
g! bundle 444
Module               osgi.identity; type="osgi.bundle"; version:Version="0.28.1.SNAPSHOT"; osgi.identity="org.eclipse.lemminx.uber-jar" [id=444]
Location             file:/.../org.eclipse.lemminx/target/org.eclipse.lemminx-uber.jar
State                32
Bundle                 444|Active     |    1|org.eclipse.lemminx.uber-jar (0.28.1.SNAPSHOT)
LastModified         1732434332385
Version              0.28.1.SNAPSHOT
RegisteredServices   null
Headers               Build-Jdk-Spec = 1.8
 Bundle-ActivationPolicy = lazy
 Bundle-ManifestVersion = 2
 Bundle-Name = lemminx uber jar bundle
 Bundle-SymbolicName = org.eclipse.lemminx.uber-jar
 Bundle-Vendor = Eclipse.org
 Bundle-Version = 0.28.1.SNAPSHOT
 Created-By = Maven Archiver 3.6.0
 Main-Class = org.eclipse.lemminx.XMLServerLauncher
 Manifest-Version = 1.0
 Service-Component = OSGI-INF/*.xml


ServicesInUse        null
BundleContext        org.eclipse.osgi.internal.framework.BundleContextImpl@e18d867
SymbolicName         org.eclipse.lemminx.uber-jar
BundleId             444

@mickaelistria mickaelistria merged commit eb03701 into eclipse-lemminx:main Nov 24, 2024
5 of 6 checks passed
@mickaelistria
Copy link
Contributor

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants