We did something similar, however, what we did was write a Buildr extension that would manage the deployment of the WAR to either Tomcat or JBoss servers. We then wrote custom rake tasks to manage the deployment tasks like starting/stopping the server.
I would suggest you do something like that instead of enhancing the package task. It will keep your buildfiles clean and simple and separate the concerns of deployment from packaging. On Thu, Aug 16, 2012 at 10:06 AM, Odelya Holiday <[email protected]>wrote: > Hi! > > I realized, that in buildr by default the order is like this: > > build all the projects > run tests on all the projects > package all the proejcts > > The thing is that I need to package the war before running the tests - > since they call my api war. > > My buildfile is as follows: > > desc 'Building engine project for engine and API' > define 'Engine' do > compile.with SPRING_CORE, > ACTIVATION,ANTLR,AOPALLIANCE,ASM,ASPECTJ > info "package engine jar" > package(:jar, :id=>"Engine") > end > > desc 'Building API project' > define 'MyBuild' do > # specify the artifact for plimus, twilio and floristone > since I > created it locally > plimus = artifact('plimus.com: > plimus:jar:1.0').from('/var/lib/selfdep/wsintegration.jar') > floristone = artifact('floristone.com: > floristone:jar:1.0').from('/var/lib/selfdep/floristone.jar') > twilio = artifact('twilio.com: > twilio:jar:1.0').from('/var/lib/selfdep/twilio.jar') > # install the artifact locally > install plimus > install floristone > install twilio > libs = > AXIS_SAAJ,RESTFB,SEARCH,SEARCH_HIBERNATE,SLF4J,SLF4J_LOG4J,STAX_API,TWITTER4J_CORE,WSDL4J > compile.with libs > war = package(:war, :id=>"MyBuild") > war.with :libs => libs > package.enhance do > sh "sudo " + tomcatlocation + "/bin/shutdown.sh" > rescue nil > cp war.to_s, buildrwar > sh "sudo " + tomcatlocation + "/bin/startup.sh" > end > end > > I would like the package.enhance to happen before invoking the tests > of Engine and the tests of the MyBuild (the api) so it could check it > while tomcat is running. > > How can I do it? > -- > Odelya >
