Tomcat and Eclipse Zero Turnaround Deployment

后端 未结 3 954
情深已故
情深已故 2020-12-14 03:22

I want to be able to deploy code changes to Tomcat (near instantly), while I\'m developing in Eclipse.

So far, I have my output from Eclipse placing the built classe

相关标签:
3条回答
  • 2020-12-14 03:54

    Maybe the Web Tools Project of Eclipse with auto-redeploy enabled will help you? Add a server, open properties and under Publishing you will see a radiobutton saying "Automatically publish when resources changes". This will result in a redeploy if classes changes otherwise just overwrites resources. You can install WTP via a built in update site (Eclipse only), so check out your software updates. It is free for most servers but it does not support certain Websphere features?

    0 讨论(0)
  • 2020-12-14 03:59

    For these cases I set the eclipse build output to WEB-INF/classes as you have done and create a context file with the docBase set to the webapp folder (parent of WEB-INF) in the project. This is manually placed in conf/Catalina/localhost (assuming default configs for some elements of server.xml). End result is tomcat ends up serving from the development directory. So, change a servlet or other class and it is updated to the classes folder. Save a jsp and it is immediately available.

    If project structured like:

    src
    |-main
      |-webapp
        |-images
        |-js
        |-WEB-INF
          |-jsp
          |-classes
    

    Then context would be like:

    <?xml version="1.0" encoding="UTF-8"?>
    <Context path="/path" reloadable="true" 
        docBase="<pathtoproject>/src/main/webapp" />
    
    0 讨论(0)
  • 2020-12-14 04:03

    Try the Spring Loaded JVM agent I've described in the following answer: https://stackoverflow.com/a/37064672/1034436

    While that has worked for my Spring web application, this should work with vanilla Eclipse + WTP + Tomcat + Dynamic Web Applications since Spring Loaded works on the JVM/classloading level.

    You will still need to use the "Automatically publish when resources changes" as mentioned by @toomasr in his answer. However, you must also disable "Module auto reload by default" option as well. If you already added/published modules from Eclipse to Tomcat, then disable "Auto Reload" for each web module (via the Tomcat config page's Modules tab). That should prevent Tomcat from reloading the application when a single class file is updated, which I suspect is what all that reload/wait time is.

    0 讨论(0)
提交回复
热议问题