"clean" is the only phase on the clean lifecycle. you want a phase on the build lifecycle...
Also, you want a phase after the tests have been compiled, and probably after the tests have ran (to ensure you measure the coverage of working tests... coverage of broken tests is usually meaningless, as you are executing unplanned paths) Now for my standard disclaimer: "RUN THE DAMN TESTS TWICE!" I have seen: 1, Tests that fail when run without coverage but pass when run with coverage. 2. Tests that pass when run without coverage but fail when run with coverage. I have seen both 1 & 2 far more often that you think. In *MOST* cases of #1 and in about half the cases of #2 this has been because the developer did not understand the code optimizations that the JVM is allowed to make. In every one of these cases, switching to another valid JVM implementation has reproduced the issue. In the other half of the cases of #2 this has been because they are performance tests... and they would be expected to fail when coverage has instrumented the code. Do you have more than one thread? Run the tests twice. -Stephen 2008/12/22 Rick <[email protected]> > On Mon, Dec 22, 2008 at 4:04 AM, Stephen Connolly > <[email protected]> wrote: > > > > The Sonatype book is good, and available free online and there are other > > good tutorials. A 3-4 hours quick skim is most definitely not a waste of > > your time. > > Actually I did read the sontatype book. I reread the chapter on "the > build lifecycle" and it sounds like (following what is described in > section 10.1) if I added the phase 'clean' and goal 'cobertura' that > it should run the cobertura goal when the mvn clean phase is reached? > Yes I don't see this happening. I even tried different phases. > > Under the plugin section under build I have (other plugins removed for > clarity) > > <?xml version="1.0"?> > <build> > <plugins> > <plugin> > <groupId>org.codehaus.mojo</groupId> > <artifactId>cobertura-maven-plugin</artifactId> > <configuration> > <instrumentation> > <excludes> > > <exclude>com/foo/ondp/**/*Test.class</exclude> > </excludes> > </instrumentation> > <executions> > <execution> > <phase>clean</phase> > <goals> > > <goal>cobertura</goal> > </goals> > </execution> > </executions> > </configuration> > </plugin> > </plugins> > </build> > > > If I manually run mvn cobertura:cobertura it runs fine. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
