Maven reimport resolves module addresses against USER_HOME?


this is with Intellij 14.

I have an existing Java/Maven project for which our small team does not shared IDEA configuration. We'd like to try that, but without mucking up the project and module configuration files on individual developer machines. So, my idea was to re-import that top-level POM but target a new directory, e.g. <project_home>/ide_settings, and check that in, allowing developers to try it out at no risk to their existing system. That worked on a local test.

That worked, but I ran into an odd situation. To avoid collisions with the existing module (.iml) files in the project, I chose to have the new module files places in the ide_settings/ directory. However, I found that during Maven import/reimport, the module files were registering the module content (sources, resources, etc.) relative to my USER_HOME, e.g. something like $USER_HOME$/path/to/project/...src/main/resources. Of course this poses a problem because we don't want to force our developers to install the projects to the same locations on their hard drives.

I then tried to close the project and edit the module files to make the paths relative to $MODULE_DIR$, e.g. $MODULE_DIR$/../src/main/resources. That worked when the project was reopened - I could compile and run tests and such - but on triggering a Maven reimport the module files were edited, this time to re-add the $USER_HOME$ paths, alongside the ones I had added.

So, first lesson, don't modify the module files directly. :/

But: is there a way to do what I need to here? I'd like there to be no paths in the IntelliJ project configuration files pointing to USER_HOME, unless it's in a purely local file which never gets checked in.


Please sign in to leave a comment.