Cleaning out old modules from IntelliJ

I swap in and out modules a lot and I see remnants or references to those modules still in my workspace even though the code is no longer there. I made sure to remove them from IntelliJ and went into Windows Explorer and deleted them from the workspace directory. I have even "invalidate cache" from the File menu.

1) When I go to Tomcat Server's deployment tab and add artifacts, I still see a list of EARs/WARs that I no longer care about.

2) This is probably a bug but if I switch compilers, Intellij rebuilds EVERYTHING. It seems to resurrect my old modules and writes them back to my workspace directory (Only the EARs/WARs though).

Please advise.

Windows XP
IntelliJ 12


How do you switch between projects? Note that IDEA project may consist of several modules. Some parts of the project configuration are stored at the
module level (e.g. list of source roots, dependencies, etc) but other parts are store at the project level (e.g. configuration of WAR/EAR artifacts,
because they may include outputs of several modules). If you remove a module from the project these parts of the project configuration will remain
unchanged (you can go to File | 'Project Structure' | Artifacts to get list of EAR/WAR artifacts currently configured in the project). So if you want
to start a new project use File | 'New Project' action.

Nikolay Chashnikov
Software Developer
"Develop with pleasure!"


I actually just use one project and use the MAVEN view to import/remove different modules into my workspace.

For example:
1) I have MEGA project, which I have imported WAR modules A, B, C. When I look at the Tomcat deployment tab, I can deploy A, B, and C as exploded WARs. Now if I go to MAVEN view and remove modules B and C, those entries still remain in the Tomcat deployment tab. After using IntelliJ for several months and removing modules that I no longer use, that list of deployable artifacts can build up.

2) Going off of the first example where I removed modules B and C, I encounter a weird work directory issue. I like to keep my workspace clean so as soon as I remove the modules, I go into Windows Explorer and delete the source code which IntelliJ had pointed to. I can't remember exactly which triggers this but when I switch compiler or disable external build, IntelliJ will start to compile all the code in my workspace. There seems to be some residual meta data about older removed modules because I can still see it building them in the IntelliJ status bar. When I look at my work directory in Windows Explorer, the removed source code came back. The target and WAR files got resurrected, which I had previously deleted.


Please sign in to leave a comment.