0

I have deployed a Spring-boot app for a task/job in PCF. I can also able to tigger the 'main' method of the springboot app using below command .

cf run-task APP-NAME "$PWD/.java-buildpack/oracle_jre/bin/java 
org.springframework.boot.loader.JarLauncher"

But I would like to pass 'programme arguments' as we pass in IntelliJ IDE , so that I can get that value in args of main method.

public static void main(String[] args)

expecting a command like ,

cf run-task APP-NAME "$PWD/.java-buildpack/oracle_jre/bin/java 
org.springframework.boot.loader.JarLauncher --arg0=value0 --arg1=value1"

Please let me know if you came across this use-cases.Thanks in Advance !

Deitsch
  • 1,610
  • 14
  • 28
Avinash Jethy
  • 803
  • 2
  • 10
  • 25
  • Does that not work? `cf run-task` takes the full and exact command that you'd like it to run. That includes the command and all it's arguments. – Daniel Mikusa Jul 08 '20 at 19:26

1 Answers1

1

You can define parameters for your program with:

cf set-env APP-NAME arg0 value0 arg1 value1

Best practice ask to restage your app after that:

cf restage APP-NAME

Now you can run your program as usual:

cf run-task APP-NAME "$PWD/.java-buildpack/oracle_jre/bin/java org.springframework.boot.loader.JarLauncher"