Maven 1

jcovergae plugin doesnot seem to merge sourceDirectory and unitTestSourceDIrectory

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Cannot Reproduce
  • Affects Version/s: None
  • Fix Version/s: 1.0-rc1
  • Component/s: None
  • Labels:
    None
  • Environment:
    winxp, maven built yesterday from cvs head
  • Number of attachments :
    1

Description

when running jcoverage plugin (maven jcoverage) i end up with FileNotFoundException : <my basedir>/src/java/ProjectAggregatorTest.java.
After digging in the plugin, it seems that sourceDirectory and unitTestSourceDirectory should be merged (currently only sourceDirectory is passed to report, causing that exception. merging sourceDirectory and unitTestSourceDirectory in ${maven.jcoverage.sourceDirectory} and passing that directory to report seem to solve the issue. i hope im not missing something or a configuration thingy. attached is a patch.

Activity

Hide
dion gillard added a comment -

Applied today along with other fixes.
Blind leading the blind here....

Show
dion gillard added a comment - Applied today along with other fixes. Blind leading the blind here....
Hide
Emmanuel Venisse added a comment -

Unit test source directory isn't necessary for jcoverage plugin. I think you have another problem.

Show
Emmanuel Venisse added a comment - Unit test source directory isn't necessary for jcoverage plugin. I think you have another problem.
Hide
Emmanuel Venisse added a comment -

All works fine for me.

Could you send us more informations.

  • project definition
  • ProjectAggregatorTest is unit test source?
  • a reproductible sample
  • ...
Show
Emmanuel Venisse added a comment - All works fine for me. Could you send us more informations.
  • project definition
  • ProjectAggregatorTest is unit test source?
  • a reproductible sample
  • ...
Hide
gilles dodinet added a comment -

Emmanuel,

I thougth i was missing something since the jcoverage report displays informations about the test classes coverage, that doesnot really make sense. I hope the informations below will be kinda useful.
(im not sure if i should attach them as a separate file). A reproductible test case can be found in mevenide cvs head (http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/mevenide/mevenide-core/)

I override only the maven.jcoverage.junit.fork property, setting it to false (xml issues otherwise).

Ive restored my jcoverage plugin.jelly and rerun it. Here s the output :

<snip/>

[junit] Tests run: 9, Failures: 0, Errors: 0, Time elapsed: 0,241 sec
[junit] dir attribute ignored if running in the same VM
[junit] Running org.mevenide.util.DefaultProjectUnmarshallerTest
[junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0,131 sec
[junit] dir attribute ignored if running in the same VM
[junit] Running org.mevenide.util.MevenideUtilTest
[junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0,05 sec
jcoverage 1.0.5 copyright (c)2003 jcoverage ltd. http://jcoverage.com/
jcoverage is licensed under the GNU General Public License
jcoverage comes with ABSOLUTELY NO WARRANTY
Generate report for E:\workspace\mevenide-core/target/jcoverage/coverage.xml fil
e.
OutputDir = E:\workspace\mevenide-core/target/docs/jcoverage
org/mevenide/project/io/ProjectWriter.java
org/mevenide/project/source/AllTests.java
2 bis
java.io.FileNotFoundException: E:\workspace\mevenide-core\src\java\org\mevenide\
project\source\AllTests.java (Le fichier sp?cifi? est introuvable)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:103)
at java.io.FileReader.<init>(FileReader.java:55)
at org.apache.maven.jcoveragereport.CoverageReport.generateSourceFile(Co
verageReport.java:414)
at org.apache.maven.jcoveragereport.CoverageReport.generateSourceFiles(C
overageReport.java:374)
at org.apache.maven.jcoveragereport.CoverageReport.generate(CoverageRepo
rt.java:83)
at org.apache.maven.jcoveragereport.CoverageReportGenerator.execute(Cove
rageReportGenerator.java:106)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

<snip/>

AllTests is defined in src/test/java. the structure of the project is as follow :
mevenide-core
/src/java
/src/test/java
/src/test/etc
/etc
i use default outputDirectory end default testOutputDirectory. Also it can be noted that in ${maven.build.dest}/jcoverage/coverage.xml we find references to all java classes, including test classes. I guess the problem comes from here.

Below are parts of the relevant poms.

<project>
<extend>${basedir}/../mevenide-master/base-project.xml</extend>

<snip/>

<dependencies>

<snip/>

</dependencies>

</project>

parent pom :

<project>

<snip/>

<dependencies>

<snip/>

</dependencies>
<build>
<nagEmailAddress>rhill@localhost</nagEmailAddress>
<sourceDirectory>src/java</sourceDirectory>
<unitTestSourceDirectory>src/test/java</unitTestSourceDirectory>
<aspectSourceDirectory>src/aspects</aspectSourceDirectory>
<unitTest>
<includes>
<include>**/*Test.java</include>
</includes>
<resources>
<resource>
<directory>${basedir}/etc</directory>
<includes>
<include>*/.*</include>
</includes>
</resource>
<resource>
<directory>${basedir}/src/test/etc</directory>
<includes>
<include>*/.*</include>
</includes>
</resource>
<resource>
<directory>${basedir}/src/test/etc</directory>
<includes>
<include>fixtures/.</include>
</includes>
</resource>
<resource>
<directory>${basedir}/src/test/conf</directory>
<includes>
<include>*/.*</include>
</includes>
</resource>
<resource>
<directory>${basedir}/etc</directory>
<includes>
<include>.</include>
<include>META-INF/services/.</include>
<include>templates/*/.*</include>
</includes>
</resource>
</resources>
</unitTest>
<resources>
<resource>
<directory>${basedir}/etc</directory>
<includes>
<include>.</include>
</includes>
</resource>
<resource>
<directory>${basedir}/etc</directory>
<includes>
<include>META-INF/services/.</include>
</includes>
</resource>
</resources>
</build>
<reports>
<snip/>
</reports>
</project>

Show
gilles dodinet added a comment - Emmanuel, I thougth i was missing something since the jcoverage report displays informations about the test classes coverage, that doesnot really make sense. I hope the informations below will be kinda useful. (im not sure if i should attach them as a separate file). A reproductible test case can be found in mevenide cvs head (http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/mevenide/mevenide-core/) I override only the maven.jcoverage.junit.fork property, setting it to false (xml issues otherwise). Ive restored my jcoverage plugin.jelly and rerun it. Here s the output : <snip/> [junit] Tests run: 9, Failures: 0, Errors: 0, Time elapsed: 0,241 sec [junit] dir attribute ignored if running in the same VM [junit] Running org.mevenide.util.DefaultProjectUnmarshallerTest [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0,131 sec [junit] dir attribute ignored if running in the same VM [junit] Running org.mevenide.util.MevenideUtilTest [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0,05 sec jcoverage 1.0.5 copyright (c)2003 jcoverage ltd. http://jcoverage.com/ jcoverage is licensed under the GNU General Public License jcoverage comes with ABSOLUTELY NO WARRANTY Generate report for E:\workspace\mevenide-core/target/jcoverage/coverage.xml fil e. OutputDir = E:\workspace\mevenide-core/target/docs/jcoverage org/mevenide/project/io/ProjectWriter.java org/mevenide/project/source/AllTests.java 2 bis java.io.FileNotFoundException: E:\workspace\mevenide-core\src\java\org\mevenide\ project\source\AllTests.java (Le fichier sp?cifi? est introuvable) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.<init>(FileInputStream.java:103) at java.io.FileReader.<init>(FileReader.java:55) at org.apache.maven.jcoveragereport.CoverageReport.generateSourceFile(Co verageReport.java:414) at org.apache.maven.jcoveragereport.CoverageReport.generateSourceFiles(C overageReport.java:374) at org.apache.maven.jcoveragereport.CoverageReport.generate(CoverageRepo rt.java:83) at org.apache.maven.jcoveragereport.CoverageReportGenerator.execute(Cove rageReportGenerator.java:106) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) <snip/> AllTests is defined in src/test/java. the structure of the project is as follow : mevenide-core /src/java /src/test/java /src/test/etc /etc i use default outputDirectory end default testOutputDirectory. Also it can be noted that in ${maven.build.dest}/jcoverage/coverage.xml we find references to all java classes, including test classes. I guess the problem comes from here. Below are parts of the relevant poms. <project> <extend>${basedir}/../mevenide-master/base-project.xml</extend> <snip/> <dependencies> <snip/> </dependencies> </project> parent pom : <project> <snip/> <dependencies> <snip/> </dependencies> <build> <nagEmailAddress>rhill@localhost</nagEmailAddress> <sourceDirectory>src/java</sourceDirectory> <unitTestSourceDirectory>src/test/java</unitTestSourceDirectory> <aspectSourceDirectory>src/aspects</aspectSourceDirectory> <unitTest> <includes> <include>**/*Test.java</include> </includes> <resources> <resource> <directory>${basedir}/etc</directory> <includes> <include>*/.*</include> </includes> </resource> <resource> <directory>${basedir}/src/test/etc</directory> <includes> <include>*/.*</include> </includes> </resource> <resource> <directory>${basedir}/src/test/etc</directory> <includes> <include>fixtures/.</include> </includes> </resource> <resource> <directory>${basedir}/src/test/conf</directory> <includes> <include>*/.*</include> </includes> </resource> <resource> <directory>${basedir}/etc</directory> <includes> <include>.</include> <include>META-INF/services/.</include> <include>templates/*/.*</include> </includes> </resource> </resources> </unitTest> <resources> <resource> <directory>${basedir}/etc</directory> <includes> <include>.</include> </includes> </resource> <resource> <directory>${basedir}/etc</directory> <includes> <include>META-INF/services/.</include> </includes> </resource> </resources> </build> <reports> <snip/> </reports> </project>
Hide
Emmanuel Venisse added a comment -

I test your project and it works fine for me (maven jcoverage) after adding xml-apis to dependencies for run tests.

If I run with maven.jcoverage.junit.fork=false, I obtain 0% of coverage, and deafault fork value, I obtain 51%

I think you have a dependency problem with your project because I can't run 'maven site'. I obtain an exception with xdoc plugin.

Show
Emmanuel Venisse added a comment - I test your project and it works fine for me (maven jcoverage) after adding xml-apis to dependencies for run tests. If I run with maven.jcoverage.junit.fork=false, I obtain 0% of coverage, and deafault fork value, I obtain 51% I think you have a dependency problem with your project because I can't run 'maven site'. I obtain an exception with xdoc plugin.
Hide
Emmanuel Venisse added a comment -

Which maven version you use?

Can I close this issue? it's not reproductible.

Show
Emmanuel Venisse added a comment - Which maven version you use? Can I close this issue? it's not reproductible.
Hide
gilles dodinet added a comment -

Emmanuel,

ill try to add the xml-apis and set the fork property to true tonight. Yes you can close it since it appears it is a configuration issue. i will work on it till it works
thanks

Show
gilles dodinet added a comment - Emmanuel, ill try to add the xml-apis and set the fork property to true tonight. Yes you can close it since it appears it is a configuration issue. i will work on it till it works thanks

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: