简体   繁体   English

使用play2自动重新加载

[英]Auto reload with play2

This is my play2 project having maven nature: 这是我的play2项目,具有maven性质:

pom.xml with relevant code: pom.xml及相关代码:

<packaging>play2</packaging>
<plugin>
    <groupId>com.google.code.play2-maven-plugin</groupId>
    <artifactId>play2-maven-plugin</artifactId>
    <version>${play2.plugin.version}</version>

    <extensions>true</extensions>
    <configuration>
      <!-- only if using database evolutions -->
      <serverJvmArgs>-DapplyEvolutions.default=true</serverJvmArgs>
    </configuration>

    <executions>
      <!-- only if there are assets in the project -->
      <execution>
        <id>default-play2-compile-assets</id>
        <goals>
          <goal>closure-compile</goal>
          <goal>coffee-compile</goal>
          <goal>less-compile</goal>
        </goals>    
      </execution>                    
    </executions>
  </plugin>  

I run the project with command: 我用命令运行项目:

mvn play2:run

But each time I do any change to the file, I have to do mvn compile play2:run and then reload the page. 但每次我对文件做任何更改时,我都要做mvn compile play2:run然后重新加载页面。

Isn't any feature to reload with current changes without doing any maven compile each time ? 是不是每次都不进行任何maven编译而重新加载当前更改的功能?

NOTE: 注意:

I found that using mvn play2:run , it always runs in PROD mode. 我发现使用mvn play2:run ,它总是以PROD模式运行。 So this seems to be the problem. 所以这似乎是问题所在。 Don't know how to run it in DEV mode. 不知道如何在DEV模式下运行它。

Console: 安慰:

[play] [info] play - Application started (Prod)
[play] [info] play - Listening for HTTP on /0:0:0:0:0:0:0:0%0:9000

Running in DEV mode and auto-reloading features are not implemented yet. 在DEV模式下运行并且自动重新加载功能尚未实现。

I've started to work on these features recently, but it's not easy and I cannot predict wren it will be available. 我最近开始研究这些功能,但这并不容易,我无法预测它是否可用。 Sorry. 抱歉。

The only way I found is to use activator instead: 我发现的唯一方法是使用activator

activator run

And to run at specific port say 9543 use: 并在特定端口运行说9543使用:

activator run -Dhttp.port=9543

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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