使用 play2 自动重新加载
Auto reload with play2
这是我的 play2 项目,具有 maven 特性:
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>
我运行项目命令:
mvn play2:run
但是每次我对文件做任何更改时,我都必须 mvn compile play2:run
然后重新加载页面。
难道没有任何功能可以在每次不进行任何 maven 编译的情况下重新加载当前更改吗?
注意:
我发现使用 mvn play2:run
,它总是 运行s 在 PROD
模式下。所以这似乎是问题所在。不知道如何在 DEV
模式下 运行 它。
控制台:
[play] [info] play - Application started (Prod)
[play] [info] play - Listening for HTTP on /0:0:0:0:0:0:0:0%0:9000
运行 在 DEV 模式下和自动重新加载功能尚未实现。
我最近开始研究这些功能,但这并不容易,我无法预测它何时可用。对不起。
我发现的唯一方法是使用 activator
代替:
activator run
并在特定端口对 运行 说 9543
使用:
activator run -Dhttp.port=9543
这是我的 play2 项目,具有 maven 特性:
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>
我运行项目命令:
mvn play2:run
但是每次我对文件做任何更改时,我都必须 mvn compile play2:run
然后重新加载页面。
难道没有任何功能可以在每次不进行任何 maven 编译的情况下重新加载当前更改吗?
注意:
我发现使用 mvn play2:run
,它总是 运行s 在 PROD
模式下。所以这似乎是问题所在。不知道如何在 DEV
模式下 运行 它。
控制台:
[play] [info] play - Application started (Prod)
[play] [info] play - Listening for HTTP on /0:0:0:0:0:0:0:0%0:9000
运行 在 DEV 模式下和自动重新加载功能尚未实现。
我最近开始研究这些功能,但这并不容易,我无法预测它何时可用。对不起。
我发现的唯一方法是使用 activator
代替:
activator run
并在特定端口对 运行 说 9543
使用:
activator run -Dhttp.port=9543