On 19/03/10 8:34 PM, Jesse Eichar wrote:
This issue is quite important to me. Should I try to solve this using Ant? It seems like that is possible (if difficult). Or is it possible with the current Jetty plugin. I have seen hints that I can run several projects in a single jetty instance but so far I am unable to determine how to do this.

Jetty itself can handle multiple web apps in a single instance, however, the Gradle tasks don't provide a way to do this. It would definitely be a good thing if they did. Could you add a JIRA issue for this?

In the meantime, there's a few options you can use.

1. The simplest is to add extra JettyRunWar or JettyRun task instances, one for each web app. This would run each web app in a separate jetty instance, each with it's own http port. This may or may not be ok for what you need to do.

2. With some contortions, you can get access to the jetty server instance from the jetty task, and add the additional web apps programmatically.

3. Don't use the Gradle tasks, and use the jetty API directly from the build script, for example:

task runJetty << {
    def server = new Server()
    ... add the web apps
    server.start()
}


Thank you,

Jesse

    Hi,


    I have the following situation


    project


     - /src/main/webapp


     - testapp


    I want to run both applications in the same Jetty instance with
    different contexts.  I am looking at the JettyPlugin code and it
    appears like there should be a way to do this but I can't seem to
    understand how I should do it.  I tried the following:


    apply id: 'war'


    apply id: 'jetty'


    task runAll(dependsOn: jettyRun, type: jettyRun.getClass()) {


        webAppSourceDirectory = file('testapp')


    }


    No luck.  An acceptable solution would be to have 'testapp' be its
    own project (right now it is a single JSP page) and be built as a
    war file.  Then the jetty could have one webapp as the war and the
other as the normal application you get when running jettyRun.

    I have 2 requirements:


    1.  I need 2 separate applications


    2.  I need at least one of the two applications be scanned and the
    jetty auto-load the changes


    Any tips?


--
Adam Murdoch
Gradle Developer
http://www.gradle.org

Reply via email to