You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by stéphane bouchet <St...@emn.fr> on 2004/08/17 11:03:33 UTC

Jcoverage exclusion list

Hi,

I'm using maven 1.0 and jcoverage plugin 1.0.7.

I would like to exclude some classes from jcoverage and i used the 
maven.jcoverage.instrumentation.excludes property.

the problem is that i would like to exclude differents files :
*Tests.class and *Aspect.class .

It's working if i put only one pattern, but not with both .
The reference guide does not give me any clue...

Can anyone help ?


Thanks,

Stephane.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Jcoverage exclusion list

Posted by Shinobu Kawai <sh...@ieee.org>.
> As you can see, it has to follow Ant's FileSet's exclude convention,
> which you can consult at:
>     http://localhost/java/apache-ant-1.6.2/docs/manual/dirtasks.html#patterns
Oops, this one only works for me.  The global URI is
    http://ant.apache.org/manual/dirtasks.html#patterns
Sorry about that...

Best regards,
-- Shinobu Kawai

--
Shinobu Kawai <shinobu@ieee.org, shinobu@computer.org>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Jcoverage exclusion list

Posted by stéphane bouchet <St...@emn.fr>.
Shinobu Kawai a écrit :

> Hi stéphane,
> 
> 
>>>>The patch submitted works great, and this is exactly what i needed. :)
>>>
>>>Terrific!
> 
> Just looked up the word "terrific" in my dictionary.com.  It means
> either "very good" or "very bad".  Strange English word...  Anyways, I
> meant the "very good" one. ;-)
>     cf. http://dictionary.reference.com/search?db=*&q=terrific
> 

Well, i am not an english spoken person too ;) in french, the 'terrific' 
word could mean something like 'scary' .... I apologize too ;)



> 
>>Humm, yes, it is a bad idea to exclude some files from coverage, because 
>>it  produce a non-realistic report . but in the same time, there is some 
>>classes you know they will NEVER be called by your tests ( I.E : aspectJ 
>>classes, constants, main() classes .... ) and to produce a better 
>>report, it could be a solution to exclude these files.
>>
>>but, it is my point of view ;)
> 
> Actually, I don't use jcoverage for analytic reasons, but just as a
> pointer to where I might need more testing.  So if there are classes you
> don't plan to test, I guess you can exclude them from jcoverage.  I
> myself don't test autogenerated code.  I'm just too lazy to exclude them.
> :)
> 
> Best regards,
> -- Shinobu Kawai
> 
> --
> Shinobu Kawai <shinobu@ieee.org, shinobu@computer.org>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Jcoverage exclusion list

Posted by Shinobu Kawai <sh...@ieee.org>.
Hi stéphane,

> >>The patch submitted works great, and this is exactly what i needed. :)
> > 
> > Terrific!
Just looked up the word "terrific" in my dictionary.com.  It means
either "very good" or "very bad".  Strange English word...  Anyways, I
meant the "very good" one. ;-)
    cf. http://dictionary.reference.com/search?db=*&q=terrific

> Humm, yes, it is a bad idea to exclude some files from coverage, because 
> it  produce a non-realistic report . but in the same time, there is some 
> classes you know they will NEVER be called by your tests ( I.E : aspectJ 
> classes, constants, main() classes .... ) and to produce a better 
> report, it could be a solution to exclude these files.
> 
> but, it is my point of view ;)
Actually, I don't use jcoverage for analytic reasons, but just as a
pointer to where I might need more testing.  So if there are classes you
don't plan to test, I guess you can exclude them from jcoverage.  I
myself don't test autogenerated code.  I'm just too lazy to exclude them.
:)

Best regards,
-- Shinobu Kawai

--
Shinobu Kawai <shinobu@ieee.org, shinobu@computer.org>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Jcoverage exclusion list

Posted by stéphane bouchet <St...@emn.fr>.
Shinobu Kawai a écrit :

> Hi stéphane,
> 
> 
>>The patch submitted works great, and this is exactly what i needed. :)
> 
> Terrific!

Humm, yes, it is a bad idea to exclude some files from coverage, because 
it  produce a non-realistic report . but in the same time, there is some 
classes you know they will NEVER be called by your tests ( I.E : aspectJ 
classes, constants, main() classes .... ) and to produce a better 
report, it could be a solution to exclude these files.

but, it is my point of view ;)



> 
> 
>>In order to work correctly, i had to delete myself the "jcoverage.ser" 
>>file, because it contains some reference to the files i wanted to exclude.
>>
>>Could it be possible to delete this file when the "clean" goal is called ?
> 
> I put the following in my maven.xml:
>   <postGoal name="clean:clean">
>     <ant:delete file="${basedir}/jcoverage.ser" quiet="true" failonerror="false"/>
>   </postGoal>
> Works for me!


Great !

Stephane

> 
> Best regards,
> -- Shinobu Kawai
> 
> --
> Shinobu Kawai <shinobu@ieee.org, shinobu@computer.org>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Jcoverage exclusion list

Posted by Shinobu Kawai <sh...@ieee.org>.
Hi stéphane,

> The patch submitted works great, and this is exactly what i needed. :)
Terrific!

> In order to work correctly, i had to delete myself the "jcoverage.ser" 
> file, because it contains some reference to the files i wanted to exclude.
> 
> Could it be possible to delete this file when the "clean" goal is called ?
I put the following in my maven.xml:
  <postGoal name="clean:clean">
    <ant:delete file="${basedir}/jcoverage.ser" quiet="true" failonerror="false"/>
  </postGoal>
Works for me!

Best regards,
-- Shinobu Kawai

--
Shinobu Kawai <shinobu@ieee.org, shinobu@computer.org>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Jcoverage exclusion list

Posted by Emmanuel Venisse <em...@venisse.net>.
----- Original Message ----- 
From: "stéphane bouchet" <St...@emn.fr>
To: "Maven Users List" <us...@maven.apache.org>
Sent: Tuesday, August 17, 2004 2:52 PM
Subject: Re: Jcoverage exclusion list


> Emmanuel Venisse a écrit :
>
> >>    <ant:fileset dir="${maven.build.dest}">
> >>      <ant:include name="**/*.class" />
> >>      <ant:exclude name="${maven.jcoverage.instrumentation.excludes}" />
> >>    </ant:fileset>
> >
> >
> > You can use this :
> > <ant:fileset dir="${maven.build.dest}" includes="**/*.class"
> > excludes="${maven.jcoverage.instrumentation.excludes}"/>
> >
> > and define maven.jcoverage.instrumentation.excludes like this:
> >
maven.jcoverage.instrumentation.excludes=**/*Tests.class,**/*Aspect.class
> >
> > Can you test this little patch and send us the result. If it's ok, I'll
> > commit it.
> >
> > Emmanuel
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>
> Thanks for the quick reply,
>
> The patch submitted works great, and this is exactly what i needed. :)

I committed it.

>
> In order to work correctly, i had to delete myself the "jcoverage.ser"
> file, because it contains some reference to the files i wanted to exclude.
>
> Could it be possible to delete this file when the "clean" goal is called ?
>
>
> Stephane.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Jcoverage exclusion list

Posted by stéphane bouchet <St...@emn.fr>.
Emmanuel Venisse a écrit :

>>    <ant:fileset dir="${maven.build.dest}">
>>      <ant:include name="**/*.class" />
>>      <ant:exclude name="${maven.jcoverage.instrumentation.excludes}" />
>>    </ant:fileset>
> 
> 
> You can use this :
> <ant:fileset dir="${maven.build.dest}" includes="**/*.class"
> excludes="${maven.jcoverage.instrumentation.excludes}"/>
> 
> and define maven.jcoverage.instrumentation.excludes like this:
> maven.jcoverage.instrumentation.excludes=**/*Tests.class,**/*Aspect.class
> 
> Can you test this little patch and send us the result. If it's ok, I'll
> commit it.
> 
> Emmanuel
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 

Thanks for the quick reply,

The patch submitted works great, and this is exactly what i needed. :)

In order to work correctly, i had to delete myself the "jcoverage.ser" 
file, because it contains some reference to the files i wanted to exclude.

Could it be possible to delete this file when the "clean" goal is called ?


Stephane.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Jcoverage exclusion list

Posted by Emmanuel Venisse <em...@venisse.net>.
>     <ant:fileset dir="${maven.build.dest}">
>       <ant:include name="**/*.class" />
>       <ant:exclude name="${maven.jcoverage.instrumentation.excludes}" />
>     </ant:fileset>

You can use this :
<ant:fileset dir="${maven.build.dest}" includes="**/*.class"
excludes="${maven.jcoverage.instrumentation.excludes}"/>

and define maven.jcoverage.instrumentation.excludes like this:
maven.jcoverage.instrumentation.excludes=**/*Tests.class,**/*Aspect.class

Can you test this little patch and send us the result. If it's ok, I'll
commit it.

Emmanuel


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Jcoverage exclusion list

Posted by Shinobu Kawai <sh...@ieee.org>.
Hi stéphane,

> I'm using maven 1.0 and jcoverage plugin 1.0.7.
Good to hear that.  I use them, too.

> I would like to exclude some classes from jcoverage and i used the 
> maven.jcoverage.instrumentation.excludes property.
> 
> the problem is that i would like to exclude differents files :
> *Tests.class and *Aspect.class .
> 
> It's working if i put only one pattern, but not with both .
> The reference guide does not give me any clue...
> 
> Can anyone help ?
Before I start answering, why do you have test classes in your
production source tree?  Shouldn't they be separate?  That way, you only
need to specify the *Aspect.class'es.

Anyways, a quick look at the plugin.jelly tells me that you can't.
Here's what it looks like:
  <instrument todir="${maven.jcoverage.instrumentation}">
    <ant:fileset dir="${maven.build.dest}">
      <ant:include name="**/*.class" />
      <ant:exclude name="${maven.jcoverage.instrumentation.excludes}" />
    </ant:fileset>
    <ant:classpath>
      <ant:path refid="jcoverage.classpath"/>
    </ant:classpath>
  </instrument>

As you can see, it has to follow Ant's FileSet's exclude convention,
which you can consult at:
    http://localhost/java/apache-ant-1.6.2/docs/manual/dirtasks.html#patterns
As for me, I can't find a way to give multiple patterns here.

I would suggest making a patch and send it to the jcoverage-plugin
people.  That would help all of us. ;-)

Best regards,
-- Shinobu Kawai

--
Shinobu Kawai <shinobu@ieee.org, shinobu@computer.org>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org