This message was deleted.
# plugin-development
s
This message was deleted.
v
Just a simple
JavaExec
task should do.
And of course declaring the dependenc(y,ies)
b
I'm aware, but that's not what I'm after. I'm looking for some (possibly separate) executable that would download an executable jar, resolve dependencies and would make it available for me to use on the cmdline (like "npm install --global" does for example)
Gradle here would only be relevant for publishing and dependency resolution during install in this scenario
Such a tool could also not require gradle at all and instead choose to implement pom and gradle metadata resolution by itself (although i fail to see why would anyone bother)
v
Ah, I see, I thought you mean using Gradle as this is the Gradle Community Slack. 🙂 But well, you could still simply do it with a trivial Gradle build using the
application
plugin. It would download the dependencies, put start scripts and so on. You just also define the "global" place where it should be installed and maybe an executable directory that then already is in the path. But other than that at least I'm not aware of such a tool, especially as it is quite unusual to publish executable libraries to a Maven repository as they are more meant for libraries. Another option would be Kotlin
*.main.kts
scripts. As any such tool that is not Gradle would probably need some initial installation, It would be Kotlin that needs to be installed. In the
*.main.kts
script you can declare your dependencies and invoke the
main
method. So the "installation" would be to copy the script, change the dependency, and change the main class basically.
b
Ah, I expected as much. I've posted here simply because the way I envision this is combo of a gradle plugin for publishing and some binary an end user would install to consume said publications
The consuming binary would then use gradle (another prerequisite) to resolve and download dependencies and generate shell scripts after which the installed jar can be invoked on the cmd as standalone
Although it just might be easier to use embeddable kotlin compiler and some simple generated kts files
The downside would be missing gradle metadata support, but that should only be relevant in a very minor number of cases
That way the only prerequisite would be a JVM
Anyways, thanks for the ideas at least!
👌 1
m
I've been using '*.main.kts' for that purpose. It's good and preinstalled in GitHub runners. You could if you wanted to do some shell magic to add a bootstrap header that installs Kotlin. Kscript has helpers for this
Pretty interested by removing the Kotlin dependency (or even Graalvm maybe?)
b
I'll proably just build on top of embedded MainKts scripting engine to produce a cli that would download and "install" or run executable jars from maven repos or simply
*.main.kts
scripts from the url. The idea is to have something like
ktx install org.company:exe-jar:1.0.0
and then have
exe-jar
command available on your PATH
i.e. experience would be on par with
dnf install curl
v
Actually, it might be more complex though. For example different executables might need different Java versions, ...
b
I'm aware, for that I plan to support some known keys in jar manifest or simply a cmdline option to provide custom JAVA_HOME to use for the executable
But that's not my immediate concern, for now I just want to easily install my own scripts and jvm binaries after I reinstall my OS 😄
m
FWIW, if you're on MacOS, I've had some success with Homebrew inspired by https://github.com/JakeWharton/homebrew-repo/blob/trunk/Formula/dependency-watch.rb