unable to resolve class - module classpath seems to be wrong

I have a project that includes many EasyB tests, which are all under the test/easyb directory. So the basic organization is:

  • module
    • src
      • source code...
    • test
      • easyb
        • SomeSupportClass.groovy
        • someStory
        • someOtherStory


Everything runs right. I generally run my tests via run configurations in the project.
When I work on my laptop, my configuration is slightly different (e.g. a different JDK). So I ended up creating another IDEA project for use in my laptop and having the main module in this project point to the same directories in my git repository. This IDEA project sits in a siblig directory to the original project and simply points at its source and test directories and uses the same dependencies. The two projects do not "know" about each other and they do not share modules.

Everything works fine in my "regular" projetc. In my "laptop" project all Java code runs just fine with no problem. But Groovy test code in the laptop project does not run. The EasyB stories use some support file in the test environment which are Groovy classes whose source files are in the same directory as the test files. When I try to run a run configuration for my test files (EasyB stories) I get compilation errors whenever my story file refers to any of the supporting classes (e.g. "unable to resolve class TestHelper"). If i try to use the Easyb X plugin to run tests on the laptop then it does not identify the story files at all. If I use a "manual" run configuration that explicitly runs the org.easyb.BehaviorRunner with the desired stories then it tries to run those story files but they do not compile due to the error explained before.

I cannot find out what in my setup is wrong such that the test directories do not get picked up for the groovy class path (in the console I can see that the class path that is generated by IDE does not include the test or the test/easyb directories)

It has to be something simple, but I really have a hard time finding out what the problem may be...

BTW, if I move the test support files to the main src directory then everything is fine. so the issue is strictly with the test and test/easyb directories not being included in the classpath. It does not matter whether they are marked test directories or source directories in the module...

0

There is no need in the second project. You should add yourproject/.idea/workspace.xml to git-ignore and configure jdks (with the same name in IDEA settings) on your laptops. They won't conflict.

0

请先登录再写评论。