From: Gordon H. <gor...@ya...> - 2012-11-30 21:59:24
|
Hi, I think we got our wires crossed somewhere in this email thread. My original question assumed that the war is built using the instrumented classes (which worried me) BUT David points out that cobertura creates the instrumented classes in target/generated-classes/cobertura and leaves the non-instrumented class files alone in target/classes. The tests are run against the instrumented classes, test and test coverage results are recorded, then the war is built from the non-instrumented classes. That's my understanding of things (ie. of the default maven behaviour). I don't want instrumented classes being put into the war, so this is all good news for me :) Someone please confirm I've understood things correctly? Gord >________________________________ > From: Steve Christou <sch...@gm...> >To: John W. Lewis <Joh...@sa...> >Cc: "KARR, DAVID" <dk...@at...>; Gordon Harris <gor...@ya...>; "cob...@li..." <cob...@li...> >Sent: Friday, November 30, 2012 1:17:35 PM >Subject: Re: [Cobertura-devel] Use of cobertura in CI > > >Well let me ask this, how are you deploying your war file? One solution I would do is in the deploy phase run a mvn clean package to clean the .war file and re-package it. Then you run the deploy after that. So for hudson/jenkins you have a second job that will be devoted to just deployment. What I would do is have one job that compiles and runs tests which displays results (cobertura and junit failures), and the final one that deploys. > > >I think what John's talking about is overriding the deploy target for maven. > > > >On Fri, Nov 30, 2012 at 2:20 PM, John W. Lewis <Joh...@sa...> wrote: > > >>Right, and unfortunately, I don’t know enough about Maven to tell how to override the default behavior. Somehow, you have to either use the “todir” mechanism that Steve mentioned, or you need to make a copy of the war before it is instrumented. >> >>From:KARR, DAVID [mailto:dk...@at...] >>Sent: Friday, November 30, 2012 3:16 PM >>To: Steve Christou; Gordon Harris >> >>Cc: cob...@li... >>Subject: Re: [Cobertura-devel] Use of cobertura in CI >> >>The default with Maven just “does the right thing”. You’re right that you shouldn’t be deploying your instrumented classes, and that’s what the default provides for. Instrumentation will default to writing classes to “target/generated-classes/cobertura” instead of “target/classes”. >> >>From:Steve Christou [mailto:sch...@gm...] >>Sent: Friday, November 30, 2012 11:52 AM >>To: Gordon Harris >>Cc: cob...@li... >>Subject: Re: [Cobertura-devel] Use of cobertura in CI >> >>You should never have to deploy an instrumented war file to a deployed environment. If i'm correct you are using maven to try and instrument. The cobertura ant task has a "todir" variable which creates a new file with instrumented code that way you have 2 different copies (one instrumented and one not instrumented). You will need to investigate if maven can do this at all. >> >>Thanks, >>Steve. >> >>On Fri, Nov 30, 2012 at 1:40 PM, Gordon Harris <gor...@ya...> wrote: >>Hi, >> >>I am using cobertura for the first time. I'm trying to understand the right way to use it with Jenkins CI. >> >>We are writing a webapp. We have unit tests. Jenkins is setup to perform maven builds triggered by svn commits. The last step of a successful build is to deploy the generated war to a Tomcat instance for QA/demo purposes. >> >>I have Jenkins and the pom setup to run tests with cobertura. Jenkins shows lovely cobertura graphs :) >> >>My concern is that we should NOT be deploying the instrumented war to Tomcat. I do not need to track code coverage in the deployed environment. Tomcat should be running the app as may be released to production (ie. non-instrumented). But AFAIK there's only the one war being generated by the build. >> >>What's the right thing to do here? Am I mistaken about what the build generates? Is the solution to have separate projects running in Jenkins, one for cobertura and one for deploying to Tomcat? What do other people do? >> >> >>Gord >> >>------------------------------------------------------------------------------ >>Keep yourself connected to Go Parallel: >>TUNE You got it built. Now make it sing. Tune shows you how. >>http://goparallel.sourceforge.net >>_______________________________________________ >>Cobertura-devel mailing list >>Cob...@li... >>https://lists.sourceforge.net/lists/listinfo/cobertura-devel >> > > > |