mvn tomcat7:deploy not work if no restart tomcat

562 Views Asked by At

I'm trying to deploy a war on tomcat via maven (mvn clean install tomcat7:deploy). The deployment seems to work fine, but the application only works if I restart tomcat. It is normal? I think not.

2

There are 2 best solutions below

1
On BEST ANSWER

tomcat7:deploy only responsible to put the updated WAR file to Tomcat:

Deploy a WAR to Tomcat.

To use Tomcat hot deploy when war file changes, see answers

0
On

By setting contextReloadable>true</contextReloadable> like this:

    <plugin>
        <groupId>org.apache.tomcat.maven</groupId>
        <artifactId>tomcat7-maven-plugin</artifactId>
        <version>2.2</version>
        <configuration>
            <path>/yourApp</path>
            <contextReloadable>true</contextReloadable>
        </configuration>
    </plugin>

you get a workaround: tomcat reloads the application whenever detects a change. It's not hot-deploy but, at least, you don't restart it manually.