Replies: 2 comments 3 replies
-
hmm - intriguing...so you want this: That would be kinda interesting to at least enable. |
Beta Was this translation helpful? Give feedback.
1 reply
-
Just came to 👍 this. It would be very useful for plugin-driven systems to be able to give a |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
So working on a small Jbang project that could benefit from externally defined plugins I wondered how we could enable having an extensible system using ServiceLoaders. Right now it's not possible but there are already a couple of open issues that could bring us closer:
--class-path
,--cp
torun
for adding dependencies #169)To implement a system with a plugin I could imagine 4 files:
The
app.java
would have a//DEPS spi.java
line that would cause thespi.java
to be compiled and its JAR added to the class path (in case ofjbang run app.java
)The
plugin.java
file would have both a//DEPS spi.java
line and a//FILES META-INF/services/some.spi.interface
line to add the file to the JAR's resources when built.The
plugin.java
would never berun
but only used withbuild
(which can happen automatically so no need to run that manually).And finally to run the application you'd do
jbang run --deps plugin.java app.java
The
--deps
parameter would add the dependency to the plugin's JAR file at runtime where the application could look it up using the ServiceLoader system (compilingplugin.java
as needed).The nice thing is that this could work with existing features or ones that were already planned for inclusion.
Wdyt?
Beta Was this translation helpful? Give feedback.
All reactions