Return-Path: Delivered-To: apmail-buildr-users-archive@www.apache.org Received: (qmail 40454 invoked from network); 22 Jul 2009 09:05:17 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 22 Jul 2009 09:05:17 -0000 Received: (qmail 39910 invoked by uid 500); 22 Jul 2009 09:06:22 -0000 Delivered-To: apmail-buildr-users-archive@buildr.apache.org Received: (qmail 39860 invoked by uid 500); 22 Jul 2009 09:06:22 -0000 Mailing-List: contact users-help@buildr.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@buildr.apache.org Delivered-To: mailing list users@buildr.apache.org Received: (qmail 39850 invoked by uid 99); 22 Jul 2009 09:06:22 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Jul 2009 09:06:22 +0000 X-ASF-Spam-Status: No, hits=4.4 required=10.0 tests=HTML_MESSAGE,NORMAL_HTTP_TO_IP,SPF_SOFTFAIL,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: softfail (nike.apache.org: transitioning domain of assaf@labnotes.org does not designate 209.85.132.240 as permitted sender) Received: from [209.85.132.240] (HELO an-out-0708.google.com) (209.85.132.240) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Jul 2009 09:06:10 +0000 Received: by an-out-0708.google.com with SMTP id c3so18305ana.17 for ; Wed, 22 Jul 2009 02:05:49 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.135.9 with SMTP id i9mr814780and.169.1248253548822; Wed, 22 Jul 2009 02:05:48 -0700 (PDT) In-Reply-To: <1248209219.2948.3.camel@localhost.localdomain.tld> References: <1248105438.3165.69.camel@localhost.localdomain.tld> <5037b6e40907202004u20e4c16bidd0420efeaef43d0@mail.gmail.com> <1248169816.16697.7.camel@localhost.localdomain.tld> <5037b6e40907211102w19e49323hb3ba639c75377379@mail.gmail.com> <1248209219.2948.3.camel@localhost.localdomain.tld> From: Assaf Arkin Date: Wed, 22 Jul 2009 02:05:28 -0700 Message-ID: <5037b6e40907220205v5a82c471o28759d7822a6b6d6@mail.gmail.com> Subject: Re: Running several jetty instances in different subprojects To: users@buildr.apache.org Content-Type: multipart/alternative; boundary=0016e645b88e5e051a046f47adfe X-Virus-Checked: Checked by ClamAV on apache.org --0016e645b88e5e051a046f47adfe Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On Tue, Jul 21, 2009 at 1:46 PM, Martin Grotzke < martin.grotzke@javakaffee.de> wrote: > On Tue, 2009-07-21 at 11:02 -0700, Assaf Arkin wrote: > > On Tue, Jul 21, 2009 at 2:50 AM, Martin Grotzke < > > martin.grotzke@javakaffee.de> wrote: > > > > > Hi Assaf, > > > > > > thanx for your response! Unfortunately, I don't see how/where to use > the > > > Jetty.new exactly. > > > > > > When I just Jetty.new("foo", "http://localhost:8090") then buildr > > > complains about > > > uninitialized constant Jetty > > > > > > Try Buildr::Jetty.new( =85 > Sorry, but I just don't get it. Where shall this go to? I still want to > be able to run jetty in two subprojects. What I'm using in one > subproject until now is this: > > task("jetty"=3D>[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 > > What is required so that I can use different instances of jetty in > different subprojects? > When you call the jetty method, you get a single instance of the Jetty clas= s [1]. That's clearly not what you want, so don't call the jetty method -- create the instance directly and use that instance instead of the one returned by the jetty method. It's just an object and all you need is a variable to reference it. Assaf [1] http://github.com/apache/buildr/blob/a25989f6aaa79a25e9727237977cde24891828= 6e/addon/buildr/jetty.rb#L244-246 > > > Thanx && cheers, > Martin > > > > > > > To limit namespace pollution, everything is defined in the Buildr > namespace. > > A lot of stuff is also conveniently accessible from the global > namespace, > > so global namespace is good place to look for thing, if not there, try > the > > Buildr namespace. > > > > Assaf > > > > > > > > > > > > > Can you provide a more complete example? > > > > > > Thanx && cheers, > > > Martin > > > > > > > > > On Mon, 2009-07-20 at 20:04 -0700, Assaf Arkin wrote: > > > > On Mon, Jul 20, 2009 at 8:57 AM, Martin Grotzke < > > > > martin.grotzke@javakaffee.de> wrote: > > > > > > > > > Hi, > > > > > > > > > > our project contains several subprojects. Two of them I want to r= un > > > with > > > > > jetty, both instances shall be running at the same time. > > > > > > > > > > To change the port for one of the instances, I use > > > > > jetty.url =3D "http://localhost:8090" > > > > > in the context of one subproject, but this seems to change also t= he > 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"=3D>[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 =3D "http://localhost:8090" > > > > > task("jetty"=3D>[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 differe= nt > > > > > subprojects? > > > > > > > > > > > > Each time you call the jetty method it will return the same one > instance > > > of > > > > jetty. The jetty task is run after the buildfile, at which point t= he > > > last > > > > value you set to jetty.url is the current value, which happens to b= e > > > 8090. > > > > > > > > If you want multiple instances, Jetty.new(name, url) and give each > one a > > > > different URL. Name is used to namespace the setup/teardown/use > task, so > > > > you can use the same name for all instances, or pick different one. > > > > > > > > Assaf > > > > > > > > > > > > > > > > > > > > > > > > Thanx && cheers, > > > > > Martin > > > > > > > > > > > > > > --0016e645b88e5e051a046f47adfe--