Hi,

I have a follow up question on this: I just try to get the jetty ant
task ([1]) running and it works so far: I can start jetty with s.th.
like
  $ buildr myproj:jetty
what brings up jetty in the active shell.

Unfortunately, I cannot stop the buildr/ruby process with CTRL-C within
this shell. I tried several combinations of Thread.new, trap('SIGINT')
etc., but didn't get it to work - only kill -9 does the trick...

This is the task that I defined for starting jetty:

JETTY_ANT = transitive('org.mortbay.jetty:jetty-ant:jar:6.1.19')
define "myproj" do
 ...
 task("jetty"=>[package(:war)]) do |task|
  ant('jetty') do |ant|
  
    cp = JETTY_ANT.each(&:invoke).join( File::PATH_SEPARATOR )
    ant.taskdef :resource=>"tasks.properties", :classpath=>JETTY_ANT.join( 
File::PATH_SEPARATOR ), :loaderref=>"jetty.loader"
    ant.typedef :name=>"selectChannelConnector", 
:classname=>"org.mortbay.jetty.nio.SelectChannelConnector",\
                :classpath=>cp, :loaderref=>"jetty.loader"
    
    ant.jetty :tempDirectory=>"jetty-temp" do
      ant.webApp :name=>"processing", :warfile=>"#{task.prerequisites.first}", 
:contextpath=>"/myproj"
      ant.connectors do
        ant.selectChannelConnector :port=>"8090"
      end
    end
  
  end
 end
end

Is it somehow possible to interrupt the running jetty/ant/buildr/ruby
process from within the interactive shell?

Thanx && cheers,
Martin


[1] http://docs.codehaus.org/display/JETTY/Ant+Jetty+Plugin



On Mon, 2009-07-20 at 17:57 +0200, Martin Grotzke wrote:
> Hi,
> 
> our project contains several subprojects. Two of them I want to run with
> jetty, both instances shall be running at the same time.
> 
> To change the port for one of the instances, I use
>   jetty.url = "http://localhost:8090";
> in the context of one subproject, but this seems to change also the url
> for the jetty task defined in the different subproject.
> 
> That's how I define the jetty tasks:
> 
> define "myproj" do
> 
>   define "subprojA" do
>     ...
>     task("jetty"=>[package(:war), jetty.use]) do |task|
>       jetty.deploy("http://localhost:8080";, task.prerequisites.first)
>       puts 'Press CTRL-C to stop Jetty'
>       trap 'SIGINT' do
>         jetty.stop
>       end
>       Thread.stop
>     end
> 
>   end
> 
>   define "subprojB" do
> 
>     jetty.url = "http://localhost:8090";
>     task("jetty"=>[package(:war), jetty.use]) do |task|
>       jetty.deploy("http://localhost:8090";, task.prerequisites.first)
>       puts 'Press CTRL-C to stop Jetty'
>       trap 'SIGINT' do
>         jetty.stop
>       end
>       Thread.stop
>     end
> 
>   end
> 
> end
> 
> When I run the first jetty with
>   buildr myproj:subprojA
> it fails with
> ...
> Starting Jetty at http://localhost:8090
> 1 [main] INFO org.mortbay.log - Logging to 
> org.slf4j.impl.SimpleLogger(org.mortbay.log) via org.mortbay.log.Slf4jLog
> 15 [main] INFO org.mortbay.log - jetty-6.1.3
> 74 [main] INFO org.mortbay.log - Started SocketConnector @ 0.0.0.0:8090
> Jetty started
> Buildr aborted!
> Connection refused - connect(2)
> 
> 
> Is it somehow possible to run several jetty instances for different
> subprojects?
> 
> 
> Thanx && cheers,
> Martin
> 

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to