Scala not recompiled between test runs?
Hi,
When I run a test as a Specs after making a change to it that should make it fail, it still passes, if I use maven to compile it, then it fails correctly. Basically even if I manually compile from Intellij it does not seem to pick up the scala specs test change. Any ideas?
Here is some more details:
1>Run/Debug configuration has 'make before launch checked'
2> If I click rebuild project or even recompile the individual scala class file I get : "All files are uptodate." and still no change.
3> My scala compiler has compile scala files first checked.
4> Compiler top level settings has compile in background checked.
5> jdk 1.5 is selected as my project compiler
6> the scala files are under the test directory and are marked as test src in project structure.
Thanks,
Pete.
Please sign in to leave a comment.
I have a similar problem, reported here: http://jetbrains.net/jira/browse/SCL-900
Do you have a single-module or multi-module project?
If I explicitly invoke 'build module' before running the tests, this is fixed.
While similiar I am not sure it is the same cause.
If I re'make' the single module it still fails to recognise the change. If however I run the maven compile target then subsequently the Scala is compiled correctly and the test fails (the code was recompiled).
Thanks for linking in the bug though I hope it proves to be related and a single solution can fix it.
Thanks,
Pete.
May be useful to know I am using Diana 9848
Try adding this to your test to be 100% sure about where the IntelliJ Test Runner is finding the .class file.
println(classOf[MyTest].getProtectionDomain.getCodeSource)
Then compare the timestamp of that file with the source file after make project.
Just a heads up, I have the same issue with #9848 of IDEA and version 0.2.24468 of the Scala plugin - when I attempt to run a Specs test case (with or without the JUnit mixin) which is in a multi-project maven build (or multi module IDEA project) the test is not recompiled.
I only started seeing this in the new version of the scala plugin - I don't remember seeing this issue when running Specs with the JUnit/ScalaTest mixin on earlier versions of the Scala plugin
If I go into the Run/Debug Configurations for the Specs I'm trying to run and in the "Before launch" section click "run Maven goal" and then choose "scala:testCompile" for the module i'm in, then things work fine. Though this is kinda painful; the Specs/JUnit/ScalaTest plugin should do this by default anyway?
Maybe its the default "Make" (in the Before launch section) is no longer noticing scala file changes or something?
I had a similar problem with a Scala project built by Maven using the mvn idea:idea target. It turned out the resource pattern was incorrectly set by the Maven builder.
See
http://www.jetbrains.net/devnet/thread/280213?tstart=0
a.k.a.
Run problems from a Maven-generated archetype
My resource patterns in the compiler settings were okay. However, I think that the Scala Facet was missing from the module containing the tests.
I have a feeling the plugin actually compiles scala code in modules without the Scala Facet in some circumstances during rebuild-all if any module has the facet enabled. This is quite confusing.
It was problem with module choosing. I added option to choose module for running tests, so now it's fixed. Please wait until next update.
Best regards,
Alexander Podkhalyuzin.