Intellij Debugging collects project files of the old version

I am debugging code in Intellij. I use maven to create a project, and there are various versions of the project sitting in the local .m2 repository. Intellij continues to build the old version of the code from the previous project snapshot when I start debugging. How to get IntelliJ to debug the latest code from the local repository?

+8
debugging intellij-idea maven
source share
4 answers
  • Try deleting the .jar and .war files containing your code from ~ / .m2 / repository / For me, the problem is that I created something and it is now registered in Maven because Maven is considering a newer version, but I'm not working now. I compiled, say, version "2.1" to debug something, and then returned to work on "sand-box-idea-SNAPSHOT". I keep thinking why Intellij does not collect my latest changes to the sandbox, but this is because it delays Maven version 2.1, which Maven suggests, is better than sand-box-SNAPSHOT.

  • You may have some plugins that interfere with the IntelliJ build process. I know that the Google Protocol Buffer Plug-in can cause Intellij to fail to detect dirty classes that need to be recompiled.

+3
source share

You can tell Intellij 2016 to ask you every time the source code needs to go through. File-> Settings-> Debugger

Show Alternate Source Switch

Show Alternate Source Switch

+5
source share

I met similar behavior, maybe this can help you :-)

I developed the application (using maven), and during this time I change the output package from jar to war. Maven, which contained both versions, jar and war, because maven does not delete the old jar when you change it. Since the project was pointing to the mvn repository, it still used the old jar link, but the new version was updated in the war.

I was very upset as maven compilation and tests worked fine, but Idea used me in the old version. I redesigned the draft idea, and it worked fine later.

+1
source share

I saw this just recently after upgrading from IDEA 13 to IDEA 14. It seems that the startup configurations created in IDEA 13 no longer automatically run the mvn package before starting.

To fix this, I manually added the mvn target in the Before Launch dialog box.

0
source share

All Articles