play2-war-plugin Change application path

2019-07-08 04:26发布

问题:

In the Play2-war-plugin source code, I saw this piece of code

  val applicationPath = Option(System.getProperty("user.home")).map(new File(_)).getOrElse(new File(""))

On my windows server, this is translated to c:\users\myloginuser

I would like my application to perform file operations under \webapps directory instead of users directory. Is there anyway to achieve this by using Play.application().path()?

回答1:

You can try to change the user.home param while launching your app :

start -Duser.home=c:\users\myloginuser\webapps //not tested