IntelliJ IDEA Working Directory

When you’re switching from one IDE to another, even if the codebase is the same, some differences might occur. This happens e.g. when using relative paths.

Assume you have a multi-module Maven project with a structure somewhat like below:

| \—myApp.component
| \—

Trying to execute in IDE the following code present in the

private final String POM_PATH = "pom.xml";
// ...
PomEquippedResolveStage Maven.configureResolver()
                             .loadPomFromFile( POM_PATH );

In Eclipse, by default, it will load the pom.xml from the (sub-module).
In IntelliJ IDEA, by default, it will load the pom.xml from the myApp (root).

Now, this behavior can be easily changed in IDEA. Just edit your “Run configuration” and select one of the predefined values for “Working directory”. E.g. if you want to have the same behavior as in Eclipse, just use $MODULE_DIR$.

It’s one of those small things that can really take you some time if your team uses Eclipse and IntelliJ IDEA.