I have gotten around this problem by specifying version 2.0 of the cobertura plugin. This causes Maven to use version 1.7 of Cobertura which does not exhibit this problem.

----- Original Message ----- From: "Hans L'Hoest" <[EMAIL PROTECTED]>
To: "Maven Users List" <users@maven.apache.org>
Sent: Monday, January 08, 2007 8:01 AM
Subject: Re: How to put cobertura.ser in target DIR


Hello all,

I seem to be running into the same problem: I can't configure the
cobertura datafile.

When running cobertura:cobertura I am getting:

"Cobertura: Coverage data file C:\projects\myproject\cobertura.ser
either does not exist or is not readable.  Creating a new data file."

Followed by lines like:

"[cobertura] INFO  [main]
net.sourceforge.cobertura.reporting.html.HTMLReport - Data file does
not contain instrumentation information for the file
MethodEditor.java.  Ensure this class was instrumented, and this data
file contains the instrumentation information."

It seems the instrumentation is saved to a different ser file than the
one that is being used by the report generation. (The instrument goal
instruments more classes than on the 2nd run with the cobertura goal.)

I can get it to work with a manual step:
* First run: mvn clean cobertura:instrument
* Then I copy the cobertura.ser file from
C:\projects\myproject\target\cobertura to C:\projects\myproject
* I run mvn cobertura:cobertura

My report is generated fine. No errors.

Any idea how I can fix this (this has nothing to do with the clean
goal it seems as the correct file cannot be found.)?

Thank you,
Kind regards,

Hans



On 10/4/06, Joakim Erdfelt <[EMAIL PROTECTED]> wrote:
Hi,

The situation with the dataFile parameter, is that it is unreliable to
use System Properties from within the embedded nature of the
cobertura-maven-plugin.

The bug has a fix on the cobertura side:
https://sourceforge.net/tracker/index.php?func=detail&aid=1543280&group_id=130558&atid=720017

Go encourage the cobertura folks to commit that patch.
Full disclosure: Yes I wrote that patch, so I'm a little biased. ;-)

The current cobertura-maven-plugin snapshot available in subversion
already supports that cobertura patch.

Once that patch is applied on the cobertura side, we should be able to
reliably set the dataFile parameter. yay!

You can also use the maven-clean-plugin to clean out that file.

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-clean-plugin</artifactId>
  <configuration>
    <filesets>
      <fileset>
        <directory>${basedir}</directory>
        <includes>
          <include>cobertura.ser</include>
        </includes>
      </fileset>
    </filesets>
  </configuration>
</plugin>

(caution, I wrote this out from memory, it might contain typos.)

- Joakim Erdfelt

dan tran wrote:
> oopps, the doc did say we can not change this location due to bug in
> corbertura 1.6
>
> how about remove that file in your post-clean phase
>
> -D
>
>
> On 10/4/06, Mick Knutson <[EMAIL PROTECTED]> wrote:
>>
>> So how would I configure dataFile  in my plugin?
>>
>>
>>
>>
>> On 10/4/06, dan tran <[EMAIL PROTECTED]> wrote:
>> >
>> > http://mojo.codehaus.org/cobertura-maven-plugin/cobertura-mojo.html
>> >
>> > On 10/4/06, Mick Knutson <[EMAIL PROTECTED]> wrote:
>> > >
>> > > I want to know how I can put cobertura.ser into my target DIR so
>> when
>> I
>> > > run
>> > > mvn clean, the cobertura files get cleaned as well.
>> > >
>> > > --
>> > >


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to