buildr-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Grotzke <martin.grot...@javakaffee.de>
Subject Re: How to run a webapp in jetty
Date Sun, 15 Feb 2009 00:32:26 GMT
Hi Alex,

thanx a lot!

I added a page for HowTos to the wiki ([1]) with a single HowTo for this
use case ([2]).

Btw: I have the habit to use ENTER in stdout between requests to be able
to see where the logs for the new request start and where they end.
Therefore I'd prefer to use CTRL-C to stop the task. I already searched
for this and found s.th. like trap('SIGINT') { jetty:stop } and tried
this together with a loop of Readlines to prevent the build task from
finishing, but this eats my shell - its somehow broken then (e.g. no
output shown when typing).
What would be the preferred way to stop the task using CTRL-C?

Thanx && cheers,
Martin


[1] http://cwiki.apache.org/confluence/display/BUILDR/Buildr+HowTos
[2] http://cwiki.apache.org/confluence/display/BUILDR/How+to+run+jetty



On Fri, 2009-02-13 at 18:00 -0800, Alex Boisvert wrote:
> Hi Martin,
> 
> The jetty task in Ode is used for live integration tests... so the build
> starts jetty, runs many tests and shuts it down.
> 
> If you just want to run your webapp interactively, you can try the
> following:
> 
>   require 'readline'
> 
>     ....
> 
>   task("jetty"=>[package(:war), jetty.use]) do |task|
>     jetty.deploy("http://localhost:8080", task.prerequisites.first)
>     Readline::readline('[Type ENTER to stop Jetty]')
>   end
> 
> alex
> 
> 
> On Fri, Feb 13, 2009 at 4:37 PM, Martin Grotzke <
> martin.grotzke@javakaffee.de> wrote:
> 
> > Hi,
> >
> > I have a simple webapp and want to run this with jetty.
> >
> > Just running "buildr jetty:start" (with require 'buildr/jetty' in my
> > buildfile) starts jetty, but then jetty doesn't serve my webapp.
> >
> > From the ode buildfile I found the following:
> >
> >  task("start"=>[package(:war), jetty.use]) do |task|
> >    class << task ; attr_accessor :url, :path ; end
> >    task.url = "http://localhost:8080/mywebapp"
> >    task.path = jetty.deploy(task.url, task.prerequisites.first)
> >    jetty.teardown task("stop")
> >  end
> >
> >  task("stop") do |task|
> >    if url = task("start").url rescue nil
> >      jetty.undeploy url
> >    end
> >  end
> >
> > It seems that I can invoke this with "buildr mywebapp:start" ("mywebapp"
> > beeing the name I defined for my project). I see jetty starting my
> > webapp, but unfortunately it stops directly afterwards. This is the end
> > of the output:
> >
> > ====================
> > [Completed] Your build has completed: /home/grotzke/proj/mywebapp
> > buildr mywebapp:start
> > Completed in 2.625s
> > Undeploying app at /mywebapp
> > Jetty server stopped
> > ====================
> >
> > So what is the correct way to run jetty with the deployed webapp?
> >
> > Thanx in advance,
> > cheers,
> > Martin
> >
> >
> >

Mime
View raw message