Search code examples
jarazure-pipelinesazure-storageazure-artifacts

is there any way to run java .jar command without downloading the jar file?


I have a jar file stored in github and i want to use that jar file in my pipeline using the following code:

java -jar test.jar -t mytoken -s myserver -p myproject --disable-spreadsheet --disable-markdown --disable-csv  -r ./template.docx

i need to use that command as a part of my azure pipeline but I don't want to store jar file somewhere in azure. i just need to be able to use the file once it is stored in github.

i tried it but it's returning the Error:Unable to access jarfile

I can use the file now by using wget command first and then the java jar command. but now i have another issue. i need to covert the generated file to pdf and i used the below command. but i get Error: source file could not be loaded i am in the right directory and i can see the file exist.

lowriter --headless --convert-to pdf report.docx

Solution

  • You need to download the file. In this case, it's not actually a repo, it's just a GitHub release. So you can download the file with curl, wget,Invoke-WebRequest or something similar, depending on your OS platform and toolchain of choice. For example, in PowerShell, it would be something along these lines:

    Invoke-WebRequest -Uri 'https://github.com/cnescatlab/sonar-cnes-report/releases/download/4.1.1/sonar-cnes-report-4.1.1.jar' `
        -UseBasicParsing -OutFile .\foo.jar