Obtain .jar File using Gradle for Java

Is there some way to obtain the .jar file from the default Gradle for Java action? I would like to use the file that’s normally output at build/libs/<project>.jar. Didn’t see anything in the support topics on this, and I’m extremely new to GitHub Actions, so if it’s something super obvious, apologies for the basic question. Thanks.

1 Like

Hi @mciolkosz,

You can upload the jar file as an artifact, and download artifacts from the workflow.

- uses: actions/upload-artifact@v2
  with:
    name: my-artifact
    path: build/libs/project.jar

You can also upload the directory ‘build/libs’ to upload all jar files.

Please check official doc for more details:
https://docs.github.com/en/actions/language-and-framework-guides/building-and-testing-java-with-gradle#packaging-workflow-data-as-artifacts

Thanks

1 Like