简体   繁体   中英

How to start Play application without SBT plugin?

Context.

I'm looking for a way to start a Play application from within a command line tool. This needs to be dependent on the task that needs to be performed, namely an OAuth authorisation. When the users selects the task, the tool should spawn a browser window that completes the user authentication. When this completes, the rest of the authorisation process continues in the Play app. Once the security token is obtained, the Play app needs to shut down.

Question.

Is there a simple way to start (and shutdown) a Play application without using the SBT plugin (provided by Typesafe)?

You may want to have a look at ProductionDist :

In SBT run task dist (or from CLI activator dist or sbt dist ). It will create a ZIP containing your application and its dependencies, plus a run script in a `bin/' sub-directory.

From directory created by extracting the ZIP content, you can so run the application executing the provided script: ./bin/my-app (assuming your application is named "my-app").

It will also create a file named RUNNING_PID containing the PID (process ID) of the JVM running your application, so that if in background (dettached from the CLI) you can kill it properly:

kill `cat /path/to/RUNNING_PID`

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM