简体   繁体   中英

Reloading JSPs edited in Eclipse, run with tomcat7-maven-plugin

How can I get a Tomcat instance started with tomcat7-maven-plugin on the command line to reload JSPs when I edit and save them in Eclipse? It's of note that I don't want to start Tomcat via Eclipse, as I depend on some Maven plugin executions that m2e doesn't know how to map.

I start Tomcat thusly, on the command line:

mvn clean package -U tomcat7:run-war-only

Here is the configuration of the Tomcat plugin:

<plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <version>2.2</version>
    <configuration>
        <systemProperties>
            <spring.profiles.active>local</spring.profiles.active>
        </systemProperties>
        <path>/</path>
        <port>8080</port>
        <contextReloadable>true</contextReloadable>
    </configuration>
</plugin>

When I change and save a JSP in the source of the project, it'd be lovely if Tomcat could reload that without having to go through a full clean/compile/test/package/start cycle.

This can be done by adding a tomcat server plugin to your eclipse and then deploying your war in tomcat through eclipse and not from command line. If you do that, when you make any changes in JSP or Java, eclipse auto refreshes your war with out you manually triggering it.

Try

mvn clean package -U tomcat7:run

As run-war-only run a packaged war so won't see your code changes.

if you want debug in your ide use

mvnDebug clean package -U tomcat7:run

Then attach a debugger to port 8000

HTH

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM