How can I modify the archived paths in an Application plugin-generated archive?

(Tavis Elliott) #1

When I use the application plugin, running “installApp” generates (assume I’ve set applicationName to “foo”)

> ls -la build/install/foo
drwxr-xr-x 2 me me 4096 Jun 25 10:28 bin/
drwxr-xr-x 2 me me 4096 Jun 25 10:28 lib/

Good so far. Exactly what I want to see for my deployed application. Now I run “distTar”:

> ls -la build/distributions
-rw-r--r-- 1 me me 17306860 Jun 25 12:59 foo-version.tgz
> tar -tzf build/distributions/foo-version.tgz | head -3

Oh no! I don’t want the paths inside the archive to be prefixed with “foo-version”.

I’ve been tearing my hair out, there doesn’t seem to be any way to configure this? Does anyone know if this is the case?

(tess.thyer) #2

I never found a way to prevent the distTar task from inserting the unwanted directory. My workaround is to set the archiveName to something tolerable (thus making the directory name something tolerable), then allow the artifact to be renamed when the process is complete. For me, that last step happens when Jenkins publishes to Artifactory. So in the end all I added to my gradle build was:

distTar {

archiveName “${baseName}.${extension}” } <c/doe>