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.
Martin podval
source share