element-template-cli command not working in windows to apply connector template to bpmn model using java code
I have created a model using model API Fluent Builder API | docs.camunda.org
then I downloaded rest outbound connector template connectors/connectors/http/rest/element-templates/http-json-connector.json at c004654aae711fb84c2a4abc2ecd4417a5830674 · camunda/connectors · GitHub
with io.camunda.connector.e2e.ElementTemplate.from() class I set my url, method type parameters to template now with help of io.camunda.connector.e2e.BpmnFile(model).apply(updatedElementTemplate, processConenctorElementId, new File(“result.bpmn”)) I want to apply modified template to my model and generate BPMN file.
Internally code is trying to execute below commands in windows and none of these commands is available in windows and I get error:
command: ProcessBuilder(new String[0])).command(“element-templates-cli”, “–diagram”, this.bpmnFile.getPath(), “–template”, template.getPath(), “–element”, elementId, “–output”, output.getPath()).start().waitFor()
Error: Exception in thread “main” java.lang.RuntimeException: java.io.IOException: Cannot run program “element-templates-cli”: CreateProcess error=2, The system cannot find the file specified
Hey @Raj_Kishun_Singh,
Thanks for your question I hope I can help you here
First, did you install element-templates-cli
properly? It seems like the binary can’t be found on your machine.
Here’s something you can try:
npm install --global element-templates-cli
Then retry, and let me know if it helped.
Jonathan
will try this and update soon, thank you very much!!
Hi Jonathan,
I was able to do npm i element-templates-cli@0.1.0
successfully added this package using intellij idea terminal and windows cli also. however I got same error after running program. could you please help more, thank you: Exception in thread “main” java.lang.RuntimeException: java.io.IOException: Cannot run program “element-templates-cli”: CreateProcess error=2, The system cannot find the file specified
at io.camunda.connector.e2e.BpmnFile.apply(BpmnFile.java:61)
It looks like the file path is not correct.
Please follow this example here. You can even run your test in debug mode to double the paths etc.
Let me know if it helped
Thank you very much. I am able to make progress. will come back with update soon.