Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changes in source files of Maven project not reflected in tomcat

Tags:

java

maven

tomcat

My maven project is in final stage. I have deployed my war file to running tomcat instance by using mvn tomcat7:deploy command and the war file is exploded in the webapps folder. I can access all the source files in the war file through url. But the problem is, when i change anything in my source files ( jsp and servlet ) the updated war file is not reflected in the running tomcat server. my pom.xml is as follows.

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.ceino.maven</groupId>
  <artifactId>MavenWeb</artifactId>
  <packaging>war</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>MavenWeb Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <finalName>MavenWeb</finalName>
    <plugins>
        <plugin>
            <groupId>org.apache.tomcat.maven</groupId>
            <artifactId>tomcat7-maven-plugin</artifactId>
            <version>2.0</version>
            <configuration>
                <url>http://127.0.0.1:8080/manager/text</url>
                <!--<warFile>/home/shebin/Maven Folder/MavenWeb/target/MavenWeb.war</warFile>-->
                <server>TomcatServer</server>
                <path>/MavenWeb</path>
                <username>tomcat</username>
                <password>tomcat</password>
            </configuration>
        </plugin>
    </plugins>
  </build>
</project>

Am using maven 3.0.4 and tomcat 7.0.35. Pls help.

like image 650
Mohammed shebin Avatar asked Jan 31 '13 09:01

Mohammed shebin


1 Answers

Try to call mvn clean install every time before running mvn tomcat7:deploy If you still have the problem, try mvn tomcat7:undeploy before. The undeploy removes the old war file und the deploy try to push the new one

like image 173
Festus Tamakloe Avatar answered Nov 02 '22 03:11

Festus Tamakloe