Solution:

               <!--
=======================================================-->
               <!-- Cobertura Plugin -->
               <!--
=======================================================-->
               <!--
                   This plugin will generate JUnit test code coverage
reports.

                   The main declaration goes inside the
                   <pluginManagement>...</pluginManagement> section of the
                   master pom.xml

                   The second declaration needs to be in each module you
intend
                   to use coverage for like:
                       <build><plugins>
                           <plugin>
                               <groupId>org.codehaus.mojo</groupId>

<artifactId>cobertura-maven-plugin</artifactId>
                           </plugin>
                       ...
                   This local declaration allows Maven to know it exists,
and
                   to allow cobertura.ser to be cleaned up automatically.

                   The next declaration needs to be in each modules
reporting
                   section, that you intend to use coverage for like:
                       <reporting><plugins>
                           <plugin>
                               <groupId>org.codehaus.mojo</groupId>

<artifactId>cobertura-maven-plugin</artifactId>
                           </plugin>
                       ...
                   This is the declaration that actually allows Cobertura
to
                   tun for each module.

                   So there are essentially 3 declarations required if
using modules.
               -->
               <!--
=======================================================-->
               <plugin>
                   <groupId>org.codehaus.mojo</groupId>
                   <artifactId>cobertura-maven-plugin</artifactId>
                   <version>2.0</version>
                   <configuration>
                       <!-- BUG IN PLUGIN:
<dataFile>${basedir}/target/cobertura.ser</dataFile>-->
                       <instrumentation>
                           <ignores>
                               <ignore>com.example.boringcode.*</ignore>
                           </ignores>
                           <excludes>
                               <exclude>com/**/*Test.class</exclude>
                           </excludes>
                       </instrumentation>
                   </configuration>
                   <executions>
                       <execution>
                           <id>clean</id>
                           <goals>
                               <goal>clean</goal>
                           </goals>
                       </execution>
                   </executions>
               </plugin>






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]




--

Thanks

DJ MICK
http://www.djmick.com
http://www.myspace.com/mickknutson

Reply via email to