Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Integrated Tomcat in Maven reload sources?

Tags:

java

maven

tomcat

I am using maven for my webapplication to build, start and handle the libraries. So I run tomcat7:run to develop my application... But if I change the code the tomcat will not automatic reload the code changes, so I need to restart. Before maven I use the "Sysdeo Eclipse Tomcat Launcher plugin" to run and create my project. This plugin allows to the see code changes instant and I know that the PLAY! Framework do the same. So it is possible to configure maven to reload my code changes on running? I will improve my work progress...

like image 996
Rookee Avatar asked Nov 11 '13 07:11

Rookee


1 Answers

It is possible to automatically reload code changes by making sure the Tomcat context is reloadable. The tomcat7:run goal allows you to enable context reloading with the contextReloadable parameter which must be configured in the configuration section of the plugin:

    <plugin>
        <groupId>org.apache.tomcat.maven</groupId>
        <artifactId>tomcat7-maven-plugin</artifactId>
        <version>2.2</version>
        <configuration>
            <contextReloadable>true</contextReloadable>
        </configuration>
    </plugin>
like image 192
Kai Sternad Avatar answered Oct 05 '22 23:10

Kai Sternad