simplest, quickest: set eclipse up to generate a war file when you build; as a post-build step, copy that war file into your tomcat webapps directory. tomcat will recognize the change and refresh the site with no deployment necessary. note that this isn't perfect; users using that webapp may have a less than optimal experience, as tomcat restarts the webapp "under" them; but this does fit your request.
are you open to using jetty for development purposes?
if so, it's pretty simple to use with maven - just run
this may not be the best way, but it works for me.
- $eclispeworkbench/project-servlet/servlet.jardesc (should export jar to lib dir in $contextpath)
i use an rsync command to sync up changes from my jsp project to the $contextpath.
use remote debugging in eclipse for tomcat which will allow limited hot-swapping of code. if you change static fields or add methods, you will need to export the jar and restart the context.
can we use the below option? double click on server in eclipse -> server locations -> use tomcat installation. it takes control of the tomcat installation. you dont need to restart the server for changes in java classes.
i've found a simplest way: use of symbolic links: i think this is the fastest way because there is no synchronization at all: tomcat directory and your project directory will be the same directory all the time.
tomcat will periodically detect the changes and redeploy your application.
there is also a way to debug your application, so i humbly think is a good solution.
i've documented my solution here, for anyone interested.
in case, you're in hurry:
- check "never publish automatically" in tomcat(other container) in eclipse.
- start tomcat(other container) in debug mode.
in eclipse, click on the project in the top menu and make sure “build automatically” is selected. this fixed my problem. i was running eclipse with tomcat using my workspace metadata. i was also running maven in a dynamic web module project. to verify, add your application to tomcat. start tomcat from within eclipse. make sure your application is deployed and running. open the console tab in eclipse. make a change in your application. after a couple of seconds you should see your change getting automatically built and deployed to tomcat.
in your development environment, just point your tomcat server to look for jsps in whatever directory you're developing them in. as soon as you save the file, you'll be able to see the changes then.
i've managed to get this working on my development environment using the spring loaded jvm agent. while i do develop spring web applications, that project's description does mention that it is
usable on any bytecode that may run on a jvm
using the following setup, i was able to get changes to publish automatically to an attached tomcat instance (the usual eclipse wtp method). i'm using spring tool suite 3.7.3 based off eclipse mars.2 (4.5.2).
- download the latest release jar of spring loaded from their github project. this has been tested with springloaded-1.2.5.release.jar.
- setup a tomcat server in eclipse as normal (tested with tomcat 8.0.30)
- open the tomcat server's configuration page in eclipse (double-click on the server instance within the "servers" tab).
- in the "server options" section, uncheck "modules auto reload by default".
- note: if you have web modules added to the server already, you may need to disable "auto reload" on them individually via the "modules" tab (at bottom of configuration page window).
- in the "general information" section, click "open launch configuration"
- in the "arguments" tab, add the following to the end of the "vm arguments":
- to enable jars to be watched in addition to project's
.classfiles, configure the
-dspringloaded=watchjars=vm argument per this issue's comments.
- in the "arguments" tab, add the following to the end of the "vm arguments":
start the server and publish dynamic web application projects to it as usual. again, i was able to test this with spring web applications. for example, modifying code, adding/subtracting methods, etc. in @controller classes were applied nearly instantly after i save the file and eclipse builds and publish the changed class. lastly, the faq section of the spring loaded project did mention a few cases where things won't reload, so those would require a restart of the server/application. but those exceptions are much less frequent.
one more note: this does not work with the embedded pivotal tc server or vmware vfabric tc server that comes with sts. for those servers, there is a "enable java agent-based reloading (experimental)" option, but that uses the older 1.2.0 release of spring loaded, which did not work for me.
why not use an integrated tomcat server from with in eclipse if this is just for development? you can configure servers under window->preferences. once it's configured if you have a jsp called page.jsp you can right click it and select run on server. under preferences->general->web browser you can chose weather to use the built in browser or an external one. make some changes to your jsp, save, and refresh your page from the browser. the changes will be automatically reflected once you save and refresh your browser.
what works for me here is:
context.xml like this:
<context path="/myapp" docbase="myapp" debug="5"
reloadable="false" antiresourcelocking="false" antijarlocking="true">
<!-- this because i´m using spring 3.1 with tomcat -->
<loader loaderclass="org.springframework.instrument.classloading.tomcat.tomcatinstrumentableclassloader" />
then, on servers tab in eclipse, on "modules" tab, i disabled the "auto reload" to all the modules being deployed.
also let the default config to let the auto publishing.
and is using maven with wtp, don´t forget to leave the contents of src/main/resources in, because eclipse insists to exclude the contents of this folder of the final build.
only with all this i got full (vm) classes hot-deploy with resources hot-deploy!!!
change your workspace in eclipse to \tomcat\webapps since it is just for your work, this should work fine. whatever changes you make in eclipse is in the same directory tomcat looks for applications to deploy
in servers view , create a new server , don't add any resource (project) to the server yet. double click on the server in servers location. choose "use tomcat installation". modify "deploy path" to the tomcat deploy directory (ex: c:\server\tomcat 7.0.14\webapps). extend "publishing section". check "automatically publish after a build event". save and close. from the eclipse menu check "project -> build automatically". from the servers view , right click on your server , "add and remove" , publish you project.
disclaimer: i'm just a happy customer, i don't work for zero turnaround and i'm not in any way affiliated with them.
check out jrebel - it allows you to code without web application restarts. it basically works by instrumenting your classes and adapting their changes. it handles many more cases than hot deploy, including:
- adding/removing methods
- adding/removing constructors
- changing interfaces
- adding/removing implemented interfaces
- struts 2
you get a free trial quite painlessly - i suggest you give it a shot.
simply let eclipse write the class files directly to the $tomcat/webapps/mywebapp/web_inf/classes directory. then, configure apache-tomcat to check if the class files have been updated, and reload them if they have.
to configure tomcat to auto-reload a class when it changes, you need to
$tomcat/conf/context.xml and set :
you may also have to edit and reload your
webapps/$yourwebapp/web.xml file and include :
i can't remember if both changes are needed but that's how i configured my tomcat-6.0.18 to auto-reload.
there are two options.
first, eclipse lets you do this, with a slight change of configuration (see also this detailed post)
- add tomcat to the server list
- make the project "dynamic web project" (either through the creation wizard or through the facets section in the settings)
- add the project to tomcat, and configure its "deployment assembly"
- double click tomcat from the list to open the configurations
- change "publishing" to "never publish automatically" (this means the server won't get restarted when you hit ctrl+s)
- start tomcat in debug mode
this will still reflect code changes but won't restart the server.
second, i've used the filesync plugin for a long time:
- configure the plugin to send all classes from the bin director to
web-inf/classesof your tomcat installation (this is almost the same as configuring the deployment assembly)
- configure all other resources to go to their respective locations
- optionally, externalize all absolute paths from the filesync location settings to a single variable, and configure that variable in eclipse (thus you will be able to commit the filesync settings as well, if all members are using eclipse)
- add tomcat to the servers list in eclipse, configure the "server locations" option to be "use tomcat installation" (the screen opens when you double-click tomcat from the servers list)
- start tomcat in debug mode
it works perfectly for me that way. every non-structural change is reflected immediately, without redeploy.
- Integrating tomcat and eclipse as a hot-deploy environment
- Maven webapp with Eclipse and WTP plugin deploy files in stranges ways in Tomcat
- How to make eclipse tomcat use ant script to create a war and then deploy it
- Eclipse and SubClipse: How to deploy my own package with svn to a TomCat server?
- Setting up RESTful environment in Eclipse Oxygen and Tomcat 9
- How to hot deploy newly created files to Apache Tomcat in Eclipse IDE?
- Integrating tomcat and eclipse but fails to test servlet?
- How to deploy multiple wars in tomcat using eclipse and then be able to debug the code
- Hot Deploy with Eclipse & Tomcat throwing ServletException
- Eclipse "Server Locations" section disabled and need to change to use Tomcat installation
- deploy webapp from Eclipse to Tomcat root context
- difference between clean and clean working directory in Eclipse WTP with Tomcat
- How to deploy Java web application project from Eclipse to live Tomcat server?
- Creating a custom AbstractProcessor and integrating with Eclipse
- Getting JSTL to run within Tomcat and Eclipse
- Remote deploy Tomcat webapp from Eclipse
- Eclipse Kepler and JBoss Wildfly hot deployment
- Eclipse on-click deploy to remote Tomcat
- How to set JVM arguments in tomcat that work both in eclipse and using the startup.bat
- Maven Profiles and Tomcat in Eclipse
- Eclipse error setting up Maven project for class exercise: Check $M2_HOME environment variable and mvn script match
- Tomcat and Eclipse Zero Turnaround Deployment
- How Do I Package and Deploy an Eclipse Java Application?
- Handling non-OSGi dependencies when integrating Maven, Tycho and Eclipse
- Integrating Eclipse and GitHub
- How to deploy created .jar file in Apache Tomcat server in Eclipse IDE?
- Download and install button in greyed out in Eclipse for Apache Tomcat v8.0
- How does Eclipse deploy Web Application using Tomcat
- Deploying project, created with Eclipse and Maven, to Tomcat
- JNDI DataSource with Tomcat 6 and Eclipse
More Query from same tag
- Exporting WAR from Maven Source files - Eclipse
- Eclipse and Pydev plugin
- Add actionListener to a lot of JButton
- eclipse not using/finding build path sources?
- Running Android Applications on Smartphone with Lower Versions
- Problems with clear case plugin eclipse
- Why eclipse does not warn about using classes from newer java versions?
- eclipse setting questions
- eclipse plugins for remote system
- How do you update a file in SVN using Eclipse gui from your local pc
- Build Soap web project with Maven
- Eclipse won't recognize an import to a referenced library of another project on the build path
- The ECLIPSE RCP project could not be exported successfully
- Java generic "capture#n-of" compile error
- Writing a program to configure Eclipse CDT programmatically
- Get parameter values out of the QR code URL
- Eclipse - Run on Hadoop does not prompt anything
- Eclipse/Java/Android Unable to execute dex: Multiple dex files define
- How to retrieve a list of deprecated methods from a class
- How can I get a IFile instance from a File object in a non Eclipse plugin
- Initial SessionFactory creation failed.org.hibernate.HibernateException: Missing column
- Running Java program in Eclipse VS. CMD SSL certs
- The differences between Java project in Eclipse and Eclipse itself?
- How to create and attach softkeyboard in android
- Android studio path to external sdcard
- dbcp jar added automatically into project
- problem starting project in google web toolkit eclipse plugin
- Never runs `if` , always `else`
- Install previous version of GPE?
- How to turn off debugging on a project in eclipse?