Clean build with IntelliJ and maven

Clean build - 70% of the time, it solves the problem every time.

We'd like to understand every problem before solving, but sometimes it's just easier start with a clean slate and see if that works.

So if you're using IntelliJ and maven, here is how to do that.

  • Make sure you have no suspicious changes in your workspace.

  • If you want to be really through, you can delete this directory, in order to make maven get all dependencies anew C:\Users\YOUR_USERNAME\.m2\repository I rarely include this step, it's too much extra time, and most problems haven't been in maven dependencies for me.

  • Open Bash or PowerShell, navigate to your project directory, and type

    mvn clean
    mvn package -pl :YourProjectName -am -DskipTests
    

    It sometimes helps to build with maven instead of IntelliJ, because they don't always follow the exact same build plan.

  • Clear IntelliJ cache and restart:

    ctrl+shift+A
    "Invalidate caches / restart"
    
  • Reimport all maven projects

    ctrl+shift+A
    "Reload all maven projects"
    

 

Topics: #ide #maven

Comments

No comments yet

You need to be logged in to comment.