Skip to content

Instantly share code, notes, and snippets.

@MarkTiedemann
Last active January 16, 2023 09:55
Show Gist options
  • Save MarkTiedemann/4a91db19983867fa1cd0c72f496ead2e to your computer and use it in GitHub Desktop.
Save MarkTiedemann/4a91db19983867fa1cd0c72f496ead2e to your computer and use it in GitHub Desktop.
@echo off
setlocal
:: Example for using the JGit CLI on Windows
:: Downloaded from https://gist.github.com/MarkTiedemann/4a91db19983867fa1cd0c72f496ead2e
:: d(irectory) p(ath) of argument 0 (the current batch file)
set "basedir=%~dp0"
:: Remove trailing slash
set "basedir=%basedir:~0,-1%"
:: Download JDK 18
if not exist "%basedir%\jdk-18.0.2.1+1-jre" (
curl -Lo "%basedir%\java.zip" https://github.com/adoptium/temurin18-binaries/releases/download/jdk-18.0.2.1+1/OpenJDK18U-jre_x64_windows_hotspot_18.0.2.1_1.zip
tar xf "%basedir%\java.zip" -C "%basedir%"
del "%basedir%\java.zip"
)
:: Download JGit 6
if not exist "%basedir%\jgit-6.4.0.sh" (
curl -Lo "%basedir%\jgit-6.4.0.sh" https://repo.eclipse.org/content/groups/releases//org/eclipse/jgit/org.eclipse.jgit.pgm/6.4.0.202211300538-r/org.eclipse.jgit.pgm-6.4.0.202211300538-r.sh
)
"%basedir%\jdk-18.0.2.1+1-jre\bin\java.exe" -cp "%basedir%\jgit-6.4.0.sh" org.springframework.boot.loader.JarLauncher %*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment