Auto reload with play2

193 views Asked by At

This is my play2 project having maven nature:

pom.xml with relevant code:

<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.

Isn't any feature to reload with current changes without doing any maven compile each time ?

NOTE:

I found that using mvn play2:run, it always runs in PROD mode. So this seems to be the problem. Don't know how to run it in DEV mode.

Console:

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

There are 2 answers

0
sjain On BEST ANSWER

The only way I found is to use activator instead:

activator run

And to run at specific port say 9543 use:

activator run -Dhttp.port=9543
0
Grzegorz Slowikowski On

Running in DEV mode and auto-reloading features are not implemented yet.

I've started to work on these features recently, but it's not easy and I cannot predict wren it will be available. Sorry.