I have created an utility (java jar-file) to generate a file upon the building process. And placed it into /tools
folder in my source code root folder.
In azure-pipelines I am using this approach to run this jar-file upon building the project (Xamarin project).
- task: CmdLine@2
inputs:
script: "java -jar $(build.SourcesDirectory)/tools/version2image.jar $(fullVersionText) $(androidVersionFileLocation)"
The task launched ok, but in the logs I get the following:
2020-08-17T14:48:45.4688112Z java -jar D:\a\1\s/tools/version2image.jar 1.0.0.123 'D:\a\1\s/XamarinProject/XamarinProject.Android/Resources/drawable/version.png' 2020-08-17T14:48:45.5231861Z ========================== Starting Command Output =========================== 2020-08-17T14:48:45.5731945Z ##[command]"C:\windows\system32\cmd.exe" /D /E:ON /V:OFF /S /C "CALL "D:\a\_temp\d5706f7c-43cd-4d50-8f17-98a6ae0a3391.cmd"" 2020-08-17T14:48:46.8000947Z Version 2 Image Utility. version 1.0 2020-08-17T14:48:46.8001744Z 2020-08-17T14:48:46.8002367Z 2020-08-17T14:48:46.8003059Z Usage: 2020-08-17T14:48:46.8004115Z 2020-08-17T14:48:46.8004468Z java -jar version2image.jar version_string output_file_location 2020-08-17T14:48:46.8004769Z 2020-08-17T14:48:46.8005096Z Example: 2020-08-17T14:48:46.8005464Z 2020-08-17T14:48:46.8005739Z java -jar version2image.jar 1.0.0.121 c:/myproject/images/version.png 2020-08-17T14:48:46.8005961Z 2020-08-17T14:48:46.8507661Z ##[section]Finishing: CmdLine
In other words Azure does not pass parameters properly to the jar file. My application thinks that it launched without parameters.
But when I run this utility locally on my computer it works ok.
If it helps, in the java utility I get command line parameters like that:
final int correctParamsCount = 2;
if (args.length != correctParamsCount) {
System.out.println("Usage:\n\njava -jar version2image.jar <version_string> <output_file_location>\n");
System.out.println("Example:\n\njava -jar version2image.jar 1.0.0.121 c:/myproject/images/version.png\n");
System.exit(0);
}
final String versionNumber = args[0];
final String outputFilePath = args[1];
How can I fix this issue?
script: 'java -jar $(build.SourcesDirectory)/tools/version2image.jar "$(fullVersionText)" "$(androidVersionFileLocation)"'
– riQQ