GitHub Action
Jar Download
The jar-download
action allows you to easily download Java jar files in GitHub Actions -- including dependencies!
While Maven Central and other repositories do allow simple curl
or wget
downloads, it's up to you to manage the sometimes-complex URL.
Plus, most jars rely on other jars to also be downloaded and included which leads to an overly complex game of "what else do I have to download?"
This action allows you to simply specify the "coordinates" of the library you need to download, and through the magic of metadata
it will download everything you need.
Maven-compatible repositories such as Maven Central identify each library with three pieces of information:
- The "Group ID" which tends to be unique to the organization or person who published the library
- The "Artifact ID" which identifies the artifact within the group
- The "Version" of the artifact.
Your package repository will tell you the groupId/artifactId and available versions.
For example, the AWS SDK for Java page on Maven Central
tells you the groupId is com.amazonaws
, the artifactId is aws-java-sdk
and the version is 1.12.370
groupId
: The Group ID of the artifact to download (required)artifactId
: The Artifact ID of the artifact to download (required)version
: The version of the artifact to download (required)outputDirectory
: The directory to download all artifacts to. Will create the directory if it does not exist (required)repository
: The URL of the Maven-compatible repository to download from. If not set, uses Maven Central.
steps:
- uses: actions/checkout@v3
- uses: nvoxland/jar-download-action@main
with:
groupId: com.mysql
artifactId: mysql-connector-j
version: 8.0.31
outputDirectory: app_libs
- run: ls -l app_libs
The scripts and documentation in this project are released under the Apache 2.0.
Pull requests and issue reports are always welcome!