Search code examples
javamavenintellij-ideapom.xmlmulti-module

IntelliJ runs old version of tests and will not compile


In the past there has been no issue updating a test and run it in IntelliJ. Now, even after a File->Invalidate Caches->Invalidate and Restart an older version of the test runs.

Running mvn clean compile before rerunning the tests in IntelliJ resolves the issue (mvn clean test also works as expected). An attempt to compile the project in IntelliJ results in a java: package com.shared does not exist. This is strange the project builds fine in Maven and IntelliJ does not catch any compile time errors with imports.

Could the error be related to the multi module project I recently created in Maven?


Solution

  • File->Invalidate Caches->Invalidate and Restart 
    

    is not enough. Here are the steps to fix:

    1. Delete .idea folder
    2. File -> Close Project
    3. Reopen the Project