In my pom.xml
, I have the following profile :
<profile>
<id>local</id>
<build>
<finalName>webProject</finalName>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<path>/</path>
<contextReloadable>true</contextReloadable>
</configuration>
</plugin>
</plugins>
</build>
</profile>
I am running tomcat with the following command from my command line:
mvn clean tomcat7:run -Plocal
Everything works great except when I edit and save my java files (using intellij) nothing happens. The app doesn't reload at all. I have tried waiting and refreshing, but nothing has worked.
Any ideas?
Here is my web.xml
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<display-name>Archetype Created Web Application</display-name>
<servlet>
<servlet-name>webProject</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring_config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>webProject</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring_config.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
Well it was a simple fix. Ill share it if anyone has the same problem. The problem was Intellij was not compiling the java files.
To get this to work, I had to go Build->Compile... (ctrl+Shift+F9)
.
Or, you can go to File ->Settings->Compiler->make project automatically
and Intellij will do it automatically.