Home > front end >  Intelli-J (Java) runs in parent folder. So it printing the current folder gives the parent of the pr
Intelli-J (Java) runs in parent folder. So it printing the current folder gives the parent of the pr

Time:12-22

After migrating to JDK17 and JUnit 5 I did first some cleaning. This works works OK also for other projects.

When I execute a simple test in Intelli-J (Java), I see that the test is run in the parent folder as base folder.

So, when I do a simple printCurrentFolder() ... then it prints the parent folder of the project folder.

How can I correct that? Anything changed?

I tried many things like:

  • Running Maven tests - works ok
  • File > Clear cache etc
  • Remove '.idea' folder.
  • Remove any *.iml file (after closing the project).

When running the JUnit test, I can see this run configuration:

enter image description here

CodePudding user response:

Set $MODULE_WORKING_DIR$ as the Working directory for your JUnit run configurations. You can make it the default as described here.

  • Related