Activator : Play Framework 2.3.x : run vs. start

后端 未结 1 429
终归单人心
终归单人心 2021-01-02 05:13

Why do these two commands behave differently?

Starting Play in production mode and starting dev mode differs?

activator run -Dconfig.file=/myConfig.c         


        
相关标签:
1条回答
  • 2021-01-02 06:11

    The fundamental difference between the two commands is what is tripping you up here. The activator starts a JVM and then executes the command you've given on the command line. The difference between run and start is the introduction of another JVM. The start command starts your program in a new JVM while run does not. So, for your four cases:

    activator run -Dconfig.file=/myConfig.conf # works
    

    The -D argument is going to activator's JVM which then executes run. It works because run is using the same JVM as the activator.

    activator "run -Dconfig.file=/myConfig.conf" # works
    

    The activator's JVM gets no -D argument but it interprets "run -Dconfig.file=/myConfig.conf" and sets the config.file property accordingly, also in the activator's JVM.

    activator "start -Dconfig.file=/myConfig.conf" # Works
    

    The activator starts a new JVM and passes the -D option to it as well as starting your program, so it works because your program gets the config.file property.

    activator start -Dconfig.file=/myConfig.conf # Doesn't work, config file not found
    

    The activator's JVM receives the -D option and then executes start command by creating a new JVM which does not get a -D option so it fails.

    0 讨论(0)
提交回复
热议问题