Set custom folder name inside distribution archive created by Zip gradle task - gradle

Zip.class gradle task create archive with the directory with the same name (as the arhive file). If i set archiveVersion property it affects on archive file name and on this directory.
Do you know how to set different names for archive file and this directory

Related

Azure release pipeline to extract files from Artifact folder and copy to a target folder

Copy files from artifacts to a folder
I am using Azure Devops Deployment group job to copy some files to the server
The 2 steps I am following are 1. Stop a Windows service using Powershell and looks OK
Then using CopyFiles task to copy the files from the Artifacts location
The artifcat is a zip file and the location is mapped correctly
I have to unzip the contents of the zip file and move to the target folder
Or move the zip file to the target folder and unzip the file contents after its copied
But the CopyFiles task is not copying any files [ I tried various combinations in Contents property to include zip extension etc but no luck]
Is any of the steps are missing or i am doing wrong? The screen shot of PIpeline is like below
Based on your requirement, you need to unzip the contents of the zip file and copy files.
I suggest that you can use Extract files to unzip the zip file.
In Copy files task, you don't need to specify a specific zip file in the source folder. You just need to specify the folder path where the files are located.
Here is an example: $(system.defaultworkingdirectory)/_Data Cloud Service Live/service

Jenkins Job - Creating a zip file with war file, appspec.yml and scripts folder

I have created a build with Jenkins for a spring boot application and it is creating a war file.
Now I want to create a second job which should create a zip file with the war file created and appsepc.yml file and a folder "scripts" folder which contains some shell script that the appspec.yml file uses. Can anyone let me know how to do this?
The job name is "Package" so the following is the structure where the different files are.
.jenkins\workspace\Package\target\cpproject.war
.jenkins\workspace\Package\appspec.yml
.jenkins\workspace\Package\scripts\after_install.sh
.jenkins\workspace\Package\scripts\before_install.sh
.jenkins\workspace\Package\scripts\start_server.sh
.jenkins\workspace\Package\scripts\stop_server.sh
Thank you.
See the Maven Assembly Plugin:
The Assembly Plugin for Maven enables developers to combine project output into a single distributable archive that also contains dependencies, modules, site documentation, and other files.
Currently it can create distributions in the following formats:
zip
...

untar a file with Gradle into a current directory and not create `build` directory

I'm using Gradle to download a dependency that is on Nexus in tar.gz format. Next, I want to untar the content of a downloaded dependency into a current directory. Currently, I have the following Gradle script:
task untar(type: Copy) {
def tarFile = file("foobar.tar.gz")
from tarTree(tarFile)
into buildDir
}
When I run the untar task, it creates a build directory and puts the content of foobar.tar.gz inside that directory.
Is it possible to untar the foobar.tar.gz into a current directory and prevent Gradle to create a build directory?
Have you tried saying into System.getProperty('user.dir') instead of into buildDir?

cant get POM file to set the outputDirectoryas as the project root

I have a POM.xml file and when i compile it it spits out the files in a default directory within the project. Is there a way to specify the file output within the
<outputDirectory>.</outputDirectory>
field? I would likle the file output to be in the root of the project folder. i want the output directory to be able to work for multiple users wherever the project is located within a computer.so it must not be specific for a single user. Is this possible?

Maven get directory name

On mvn install, a directory get created in target whose name contains buildnumber/timestamp.
Now I run mvn assembler where I need to use the same directory. I can not recreate the name since timestamp would change.
How can I retrieve the file name? I know the location of the file in my project.
Bind maven-assemlby-plugin into the build life-cycle and let it run with the usual build and you have your information available during the assembly creation.

Resources