Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do develop a Java web application without having to deploy all the time

I've set up a simple Eclipse 3.5/Jetty 6.1 web app which returns hello world. It works. This is on Windows and uses the "Jetty Generic Server Adapter". I have auto deployment working so that it deploys after changes periodically.

How do I go about setting it up so that if I change any static content it doesn't have to redeploy i.e I can just hit F5 to see the changes straight away. For minor HTML changes it's quite unusable waiting 20-30 seconds for a deployment.

like image 836
ChrisSmith..zzZZ Avatar asked Apr 19 '10 20:04

ChrisSmith..zzZZ


People also ask

Can you build a web application with Java?

Java provides support for web application through Servlets and JSPs. We can create a website with static HTML pages but when we want information to be dynamic, we need web application.


2 Answers

I haven't used Jetty before, so I can't tell from experience if that long deployment times are normal nor how to optimize it. But I would just inform that this is dependent on the server and the server plugin used. In case of Apache Tomcat 6 + Eclipse-provided plugin and Sun Glassfish v3 + GF-provided plugin the auto deployments are fast enough. Especially Glassfish v3, which is relatively slow on startup, really excels with sub-second (hot)deployments.

First step would be to check if there are alternative Jetty Eclipse plugins and then try them and/or if there is a setting to lower the hotdeploy scan interval.

like image 125
BalusC Avatar answered Sep 28 '22 07:09

BalusC


I use maven with configuration below

        <plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>maven-jetty-plugin</artifactId>
            <version>6.1.25</version>
            <configuration>
                <scanIntervalSeconds>1</scanIntervalSeconds>
                <requestLog implementation="org.mortbay.jetty.NCSARequestLog">
                    <append>true</append>
                </requestLog>
            </configuration>
        </plugin>

so jetty scans for changes every second, and for my simple application it takes about 200ms to restart app. I noticed that sometimes yetty does not sees changes in jsp files

like image 29
Maciek Kreft Avatar answered Sep 28 '22 07:09

Maciek Kreft