tronda
tronda

Reputation: 3942

How to get a reference to the jar file produced by Gradle build?

I need to sign a jar after the jar task is being done in gradle. I have a need to reference the produced jar file from the build, and I can recreate the jar file, but I really look for a property that does this for me.

Here is how I've done it:

jar.doLast {
  jarfile = project.libsDir.path + File.separator + project.Name + '-' + project.version + '.jar'
  ant.signJar(jar: jarfile, ....
}

Is there a property which can be used instead of the long "path calculation"?

Upvotes: 36

Views: 29545

Answers (1)

tronda
tronda

Reputation: 3942

jar.archivePath returns a file object pointing to the generated jar file.

Update: jar.archivePath is deprecated. Look at .archiveFile instead.

Upvotes: 55

Related Questions