How to get the archive name of a project's jarfile using the gradle API


(Rhys Kenwell) #1

Title says it all. Is it possible to get the name of a Project’s jarfile name from the Project object?


(Mark Vieira) #2

Yes. Depends on what you mean by “name”. The name is something like foo-1.0.jar and the “path” is /Users/me/workspaces/project/build/libs/foo-1.0.jar. I’ll assume you mean the latter :slight_smile:

https://docs.gradle.org/current/dsl/org.gradle.api.tasks.bundling.Jar.html#org.gradle.api.tasks.bundling.Jar:archivePath

jar.archivePath