-
Notifications
You must be signed in to change notification settings - Fork 48
Error during site generation #12
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
Comments
Hi I need stacktrace. Run "mvn site -X" and attach log here, please. BTW I see, you are testing with https://github.com/scoverage/scoverage-samples project. The "pom.xml" file in this sample is outdated and should be deleted. There are more samples in https://github.com/scoverage/scoverage-maven-samples so there is no need to update this one. |
Hi, I've cloned scoverage-maven-samples and in the simple/scala-plugin-scala-2.11 project, running "mvn clean scoverage:report -X" gives me a final output (stacktrace) of:
It looks like there's an absolute path being used when it should be relative. Thanks |
This example works for me and I use Windows too. Something is wrong inside scalac-scoverage-plugin. You can try this option http://scoverage.github.io/scoverage-maven-plugin/1.0.0/pre-compile-mojo.html#scalacPluginVersion. Set the value to 1.0.1 to use latest https://github.com/scoverage/scalac-scoverage-plugin. Maybe it's already fixed. |
Where is $MY_PATH from? |
Just my attempt to obfuscate the real path - take it as being c:\ |
The difference seems to be that I'm using Git Bash. If I use a Windows command prompt, "mvn scoverage:report" run in scoverage-maven-samples/simple/scala-plugin-scala-2.11 is successful. Unfortunately, the majority of our developers use Git Bash... I assume we're unlikely to see this issue as part of a Jenkins build when publishing a maven site. |
Interestingly, when running scoverage:report (Windows command) against the scoverage-maven-samples/simple/scala-plugin-scala-2.11 module, the various html report files are created but the service.html contains broken links, the URLs are of the form I've yet to get the report goal to work against the old scoverage-samples module, but I assume it should. |
This is because source location does not reflect package names. I did it intentionally to expose this problem and forgot about it :( I've just tried with -Dscoverage.scalacPluginVersion=1.0.1 and it didn't help. It means the bug in scalac-scoverage-plugin is still there. |
Ah. Fair enough. Do you want that raised as a separate issue for tracking? Any thoughts about the Git Bash vs Windows Command prompt, is the issue going to be the way the file serarator is determined? |
I will consult the first issue with scalac plugin author. I never used Git Bash, will learn it. |
I've just tried git bash and it works for me, but I've seen similar path problem when implementing aggregated report today. I suspect it can appear when accessing scoverage files from outside of the project/module, but I tried to execute regular report from outside of the project (scala-plugin-scala-2.11) and it worked. Anyway, I will investigate. |
I've discovered part of the problem, the build section of my pom was missing a sourceDirectory element. Adding this means "mvn clean install site" completes successfully when run from the Windows command prompt. Debugging scoverage-maven-plugin and scalac-scoverage-plugin I can see the issue when building in git bash. Basically value of the sourceDir and outputDirectory directories evaluated by scoverage-maven-plugin starts with "c:/..." (note lower case 'c'), where as in scalac-scoverage-plugin the source path of the Scala files that have been 'measured' starts with "C:/..." (note upper case 'C'). Therefore the String.replace call in the relativeSource function of ScoverageHtmlWriter does not correctly match (and replace) the absolute path. |
Thank you for your work. I'm surprised because I see "G:" in Maven invocation log with "-X" option, in I will try to help anyway, I see two potential problems: In <sourceDir>${project.build.sourceDirectory}/../scala</sourceDir> I forgot about this strange default value (http://davidb.github.io/scala-maven-plugin/compile-mojo.html#sourceDir), didn't like it since I saw it for the first time <useCanonicalPath default-value="true">${maven.scala.useCanonicalPath}</useCanonicalPath> (http://davidb.github.io/scala-maven-plugin/compile-mojo.html#useCanonicalPath) In |
I've debugged today, with and without Git Bash (I use msysgit 1.7.3.1, gitbash.exe). All my paths start with "G:" (I work on "G" drive). Always capital "G" and backslash, never slash. I wonder what differences are between our environments, why you have slash in your paths. |
So the issue appears to come from the "relativeSource" function in scoverage.report.ScoverageHtmlWriter, or more correctly the path values of the Statements in the coverage object (in "scoverage.coverage.xml", which are of the form "C:\scoverage\scoverage-maven-samples\simple\scala-plugin-scala-2.11\src\main\scala\HelloServiceScala.scala") and the path value of the sourceDirectory variable (which is of the form "c:\scoverage\scoverage-maven-samples\simple\scala-plugin-scala-2.11\src\main\scala"). Notice the upper case "C" vs lowecase "c". The string replace call in "relativeSource" is then unable to replace "C:\scoverage\scoverage-maven-samples\simple\scala-plugin-scala-2.11\src\main\scala" with "". So the question is, for me, why does the scala-scoverage-plugin use an upper case drive letter while the scoverage-maven-plugin uses a lower case driver letter when run in git bash (but not when run in Windows command prompt). nodejs/node-v0.x-archive#7880 talks about git bash normalising the drive letter to lower case. I'll investigate that. |
Please answer my questions from previous comment. Additionally, do you have "C:" and "c:" or "C:/" and "c:/" because there were slashes in you previous comment and there are backslashes. We must be very precise if we want to find a solution to this strange issue. |
SCoverage has nothing to do with Node, I don't see a word about bash in the issue you cited. |
I don't like this |
My paths start with "c:" and "C:" (note backslash). Running "mvn scoverage:report -X" I see a mixture of "c:" and "C:" being used. I was more interested in whether my git bash was normalising my drive letter to lower case rather than Node. |
Where you see lower- and where uppercase "c"? |
The classpath contains a mixture of "C:" and "c:" while the configuration for the scoverage-maven-plugin is all lowercase, e.g.: [INFO] --- scoverage-maven-plugin:1.0.0:report (default-cli) @ scoverage-samples --- The paths of files listed in the "target\scoverage.xml" and "target\scoverage-data\scoverage.coverage.xml" files all begin "C:". |
In scala-scoverage-plugin, there appears to be an inconsistent use of "canonicalPath" (in Location.scala) and "getAbsolutePath" (in ScoverageHtmlWriter.scala), according to the JavaDoc for java.io.File, "getCanonicalPath" with convert the drive letter to a standard case (for me upper case) while "getAbsolutePath" does not. |
I'm glad that you found it. I have uppercase "C" everywhere whatever I try. Will you create issue for https://github.com/scoverage/scalac-scoverage-plugin/ or should I do it? |
Probably consistent usage of canonicalPath would solve the problem. |
I can do it. In fact I'll fix it and send a pull request. Thanks for your help and patience. |
Pull request sent (scoverage/scalac-scoverage-plugin#75) |
Version 1.0.2 released. It depends on scalac-scoverage-plugin 1.0.2, containing your fix. Thank you for cooperation. |
Having updated the scoverage-samples project to use scoverage-maven-plugin version 1.0.0 according to the documentation in GitHub, i.e. in build:
and in reporting:
Running "mvn clean install" works fine (scoverage-maven-plugin runs and reports level of coverage). However running "mvn site" straight after results in a failure:
"[ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.3:site (default-site) on project scoverage-samples: Error during site generation: $MY_PATH\scoverage\scoverage-samples\target\site\scoverage$MY_PATH\scoverage\scoverage-samples\src\main\scala\com\sksamuel\scoverage\samples\SimpleObject.scala.html (The filename, directory name, or volume label syntax is incorrect) -> [Help 1]"
A "target/site/scoverage/index.html" file is created but none of the links within that page work - "$MY_PATH/scoverage-samples/src/main/scala/com/sksamuel/scoverage/samples/Charmax.scala.html" does not exist.
Please advise. Thanks
The text was updated successfully, but these errors were encountered: