Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scoverage:report fails on Windows7 #80

Closed
kupczyk opened this issue Jan 14, 2015 · 15 comments
Closed

scoverage:report fails on Windows7 #80

kupczyk opened this issue Jan 14, 2015 · 15 comments

Comments

@kupczyk
Copy link

kupczyk commented Jan 14, 2015

I want to point out that the issue reported in #74 hasn't been fixed in 1.0.2 version of scoverage plugin.
I tested it today and got the same error i.e.
error java.io.FileNotFoundException: C:\Us
ers\Piotr\Desktop\SpecDevs\developerka\specgine-devel\target\scala-2.11\scoverag
e-report\C:\Users\Piotr\Desktop\SpecDevs\developerka\specgine-devel\engine\src\m
ain\scala\animation\Tween.scala.html (The filename, directory name, or volume la
bel syntax is incorrect)

To reproduce this issue please run sbt verify command from master branch from https://bitbucket.org/specdevs/specgine

@gslowikowski
Copy link
Member

I think, it's a problem with coverageAggregate (the wrong path contains path to project root concatenated with engine module root).

@Akrome
Copy link

Akrome commented Feb 3, 2015

I can confirm this issue to happen also on Windows 8.1, though it only appears on certain projects and not on all.

Here is the output from mvn scoverage:report -e

[ERROR] C:\Users\diego.martinoia\Repo\scs-stockallocation-akka\target\site\scoverage\C:\Users\diego.martinoia\Repo\scs-stockallocation-akka\src\test\scala\com\ocado\scs\stockallocation\core\healthCheck\HealthCheckTest.scala.html (The filename, directory name, or volume label syntax is incorrect)
java.io.FileNotFoundException: C:\Users\diego.martinoia\Repo\scs-stockallocation-akka\target\site\scoverage\C:\Users\diego.martinoia\Repo\scs-stockallocation-akka\src\test\scala\com\ocado\scs\stockallocation\core\healthCheck\HealthCheckTest.scala.html (The filename, directory name, or volume label syntax is incorrect)
        at java.io.FileOutputStream.open(Native Method)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:221)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:171)
        at java.io.FileWriter.<init>(FileWriter.java:90)
        at scoverage.IOUtils$.writeToFile(IOUtils.scala:39)
        at scoverage.report.ScoverageHtmlWriter.scoverage$report$ScoverageHtmlWriter$$writeFile(ScoverageHtmlWriter.scala:42)
        at scoverage.report.ScoverageHtmlWriter$$anonfun$scoverage$report$ScoverageHtmlWriter$$writePackage$1.apply(ScoverageHtmlWriter.scala:35)
        at scoverage.report.ScoverageHtmlWriter$$anonfun$scoverage$report$ScoverageHtmlWriter$$writePackage$1.apply(ScoverageHtmlWriter.scala:35)
        at scala.collection.immutable.List.foreach(List.scala:318)
        at scoverage.report.ScoverageHtmlWriter.scoverage$report$ScoverageHtmlWriter$$writePackage(ScoverageHtmlWriter.scala:35)
        at scoverage.report.ScoverageHtmlWriter$$anonfun$write$1.apply(ScoverageHtmlWriter.scala:23)
        at scoverage.report.ScoverageHtmlWriter$$anonfun$write$1.apply(ScoverageHtmlWriter.scala:23)
        at scala.collection.immutable.List.foreach(List.scala:318)
        at scoverage.report.ScoverageHtmlWriter.write(ScoverageHtmlWriter.scala:23)
        at org.scoverage.plugin.SCoverageReportMojo.generate(SCoverageReportMojo.java:206)
        at org.scoverage.plugin.SCoverageReportMojo.execute(SCoverageReportMojo.java:314)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.

Is there any update on this issue?

@gslowikowski
Copy link
Member

@kupczyk and @Akrome - you have two different problems.

@kupczyk's problem is related to aggregation in multimodule projects.

@Akrome you use Maven, how do you add src/main/scala to project source roots? If you replace the main source root (src/main/java):

<build>
    <sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
    ...
</build>

it should work. If you add it as additional source root by using http://mojo.codehaus.org/build-helper-maven-plugin/add-source-mojo.html or http://davidb.github.io/scala-maven-plugin/add-source-mojo.html - it will not work, because Scalac Scoverage plugin does not support multiple source roots (yet?) and the first/main src/main/java is used by Scoverage Maven plugin.
I will add a note about it to Maven Scoverage plugin documentation.

@Akrome
Copy link

Akrome commented Feb 4, 2015

Hi @gslowikowski , this is from my pom

<build>
...
    <sourceDirectory>src/main/scala</sourceDirectory>
    <testSourceDirectory>src/test/scala</testSourceDirectory>
 ...
 </build>

I have tried changing it to

<build>
...
    <sourceDirectory>${project.basedir}/src/main/scala</sourceDirectory>
    <testSourceDirectory>${project.basedir}/src/test/scala</testSourceDirectory>
 ...
 </build>

as well as to

<build>
...
    <sourceDirectory>${project.basedir}\src\main\scala</sourceDirectory>
    <testSourceDirectory>${project.basedir}\src\test\scala</testSourceDirectory>
 ...
 </build>

But i still get the same error.

@Akrome
Copy link

Akrome commented Feb 4, 2015

I have also tried setting it to a non-existing folder (/scala2) for testing, and it does not seem to affect it in anyway. Are you sure that's where it's taken from?

@gslowikowski
Copy link
Member

I see scoverage tries to generate report for one of your test classes. This should not happen. Can you check why or attach maven execution log with debug info (-X parameter)?

@Akrome
Copy link

Akrome commented Feb 4, 2015

I found one of the issues. The HealthCheckTest class had a package header different than the folder structure. I fixed that, but now I have the issue in another test class, one that has the correct package header. Attached the -e -X output.

[ERROR] C:\Users\diego.martinoia\Repo\scs-stockallocation-akka\target\site\scoverage\C:\Users\diego.martinoia\Repo\scs-stockallocation-akka\src\test\scala\com\ocado\scs\stockallocation\GlobalTestModule.scala.html (The filename, directory name, or volume label syntax is incorrect)

I have tried moving it away, but it just picks on another test class. You are right, it's trying to cover the test classes too.

@gslowikowski
Copy link
Member

Tests compilation scala-maven-plugin:3.1.0:testCompile is executed with scoverage instrumentation. This is wrong. Scoverage instrumentation is turned on in generate-resources phase (find org.scoverage:scoverage-maven-plugin:1.0.4:pre-compile in the log) and turned off in process-classes phase (org.scoverage:scoverage-maven-plugin:1.0.4:post-compile). Tests should be compiles in test-compile phase which is after post-compile phase in Maven lifecycle.

You bound this compilation to some earlier phase, which is wrong. Fix it or show me scala-maven-plugin configuration and I will help you with it.

@Akrome
Copy link

Akrome commented Feb 4, 2015

Thanks for your kindness. This is the section you requested, from the plugins section of the build section:

<plugin>
  <groupId>net.alchim31.maven</groupId>
  <artifactId>scala-maven-plugin</artifactId>
  <version>3.1.0</version>
  <executions>
    <execution>
      <phase>compile</phase>
      <goals>
         <goal>compile</goal>
         <goal>testCompile</goal>
      </goals>
    </execution>
   </executions>
</plugin>

@gslowikowski
Copy link
Member

Remove <phase> element.

@Akrome
Copy link

Akrome commented Feb 4, 2015

I have commented out that whole < plugin > section without apparent effect on the result of mvn scoverage:report . I have updated the GDrive file with the new output of -e -X:

@gslowikowski
Copy link
Member

You have to run clean after such important pom.xml changes. In your project nothing got recompiled so nothing changed from scoverage report point of view.

@Akrome
Copy link

Akrome commented Feb 4, 2015

That worked! Thanks so much for your help 👍

@gslowikowski
Copy link
Member

#109 + scoverage/sbt-scoverage#98 should fix @kupczyk 's case

@gslowikowski
Copy link
Member

1.1.0 version released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants