3

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.

Ori Marko
  • 56,308
  • 23
  • 131
  • 233
un0tec
  • 170
  • 1
  • 11

2 Answers2

1

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.

1

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

Ori Marko
  • 56,308
  • 23
  • 131
  • 233
  • Hello, thanks for answering. Your answer has been useful. Also my problem was that in my context tomcat had the properties activated to not block the files, I do not know why but this causes the application does not start correctly. I have to look for the right way to do both, since my objective activating those properties was to be able to redeploy the application. Thanks again for your answer. – un0tec Nov 07 '18 at 00:02