Run problems from a Maven-generated archetype
I'm using the Scala plugin version just released a few days ago with Scala 2.7.3, IDEA 8.1 on Mac OS X 10.5
I am having problems where projects generated by the Maven "scala-archetype-simple" don't seem to recompile or run correctly.
Specifically:
1. Create a project from the command line using "mvn archetype:generate" and pick the "scala-archetype-simple" option (for me, today it was "30: internal -> scala-archetype-simple (A simple scala project").
2. Run mvn:install and verify all the tests run correctly (AppTest and MySpecTest)
3. Generate an IDEA project with mvn idea:idea
4. Open the project in IDEA using the IPR file that was generated
5. Add a Scala facet to the project (I used a per-project Scala configuration)
6. Open "AppTest", which includes a JUnit 4 test, and run it from the context menu ("Run testOK()"). The test passes.
7. Change the test from
def testOK() = assertTrue(true)
to
def testOK() = assertTrue(false)
8. Run the test again, and the test still passes, even though it should have failed. It acts like the class is not being recompiled.
Now, rebuild the project and attempt to run the test:
9. Chose "Rebuild Project" from the Build menu
10. Rerun the test, and note that it fails correctly with the red bar.
Now change the test again and run the test:
11. Change the assert back to assertTrue(true) and choose the "Run testOK()" context menu option. You'll get an error: Class not found: "com.danielwellman.AppTest"
Here's my full Run output window:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/bin/java -Dfile.encoding=MacRoman -classpath /opt/local/share/scala/lib/scala-partest.jar:/opt/local/share/scala/lib/scala-compiler.jar:/opt/local/share/scala/lib/scala-swing.jar:/opt/local/share/scala/lib/scala-library.jar:/opt/local/share/scala/lib/scala-dbc.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/deploy.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/dt.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/javaws.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/jce.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/plugin.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/sa-jdi.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/../Classes/charsets.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/../Classes/classes.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/../Classes/dt.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/../Classes/jce.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/../Classes/jconsole.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/../Classes/jsse.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/../Classes/laf.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/../Classes/ui.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/ext/apple_provider.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/ext/dnsns.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/ext/localedata.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/ext/sunjce_provider.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/ext/sunpkcs11.jar:/Users/wellman/dev/scala/ideamaventest/target/test-classes:/Users/wellman/dev/scala/ideamaventest/target/classes:/Users/wellman/.m2/repository/junit/junit/4.4/junit-4.4.jar:/Users/wellman/.m2/repository/org/specs/specs/1.2.5/specs-1.2.5.jar:/Users/wellman/.m2/repository/org/scalatest/scalatest/0.9.1/scalatest-0.9.1.jar:/Users/wellman/.m2/repository/org/scalacheck/scalacheck/1.2/scalacheck-1.2.jar:/Users/wellman/.m2/repository/org/jmock/jmock/2.4.0/jmock-2.4.0.jar:/Users/wellman/.m2/repository/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.jar:/Users/wellman/.m2/repository/org/hamcrest/hamcrest-library/1.1/hamcrest-library-1.1.jar:/Users/wellman/.m2/repository/org/scala-lang/scala-library/2.7.0/scala-library-2.7.0.jar:/Applications/IntelliJ IDEA 8.1.app/lib/idea_rt.jar com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 -junit4 com.danielwellman.AppTest,testOK
Class not found: "com.danielwellman.AppTest"
Process finished with exit code 1
To fix this problem, you need to rebuild the entire project every time before running the test.
This problem happens repeatedly with any of my Maven projects, but it does not happen with projects created through the IntelliJ "New Project from Scratch" wizard.
Am I configuring something incorrectly?
Attached is my project.
Thanks,
Dan
Attachment(s):
mavenProject.zip
Please sign in to leave a comment.
I watched your case and yes, your settings not configured right.
Change setting:
Settings -> Compiler -> Resourse patterns
This setting generated by idea:idea plugin, it is anything not java. It's wrong because scala is not resource. So you should change this to standard setting:
?*.properties;?*.xml;?*.gif;?*.png;?*.jpeg;?*.jpg;?*.html;?*.dtd;?*.tld
Best regards,
Alexander Podkhalyuzin.
Thank you - that did it!
Cheers,
Dan