IntelliJ still using old dependency

 

https://stackoverflow.com/questions/65849103/intellij-still-using-old-dependency

 

Asked 2 years ago
Modified 2 years ago
Viewed 2k times
0

I am currently using Intellij Idea 2020.2.4.

I want to replace a dependency with a newer version of itself. I replaced

<dependency>
  <groupId>com.company.digital.fmk</groupId>
  <artifactId>dgt-security</artifactId>
  <version>2.6.24</version>
</dependency>

with

<dependency>
  <groupId>com.company.digital.fmk</groupId>
  <artifactId>dgt-security</artifactId>
  <version>3.9.0</version>
</dependency>

I've checked that in the effective pom, the version has changed to the new value. However, after running mvn -U clean install, when I click on a class from the dependency, it still shows the old version.
When I try to delete the old version from the project structure, it says that it is still used in a module, even though I can't find the old version number anywhere in the project.
I can't manually delete the old library from my local folder, because it is used in another project.

Other answers have suggested using Maven -> Reimport, but I didn't find this in my intellij

What can I do to make intellij use the new dependency version in my project ?

EDIT

When I right-click on a project and select Maven, here are my options:

  • Reload project (already tried, did not work)
  • Generate sources and update folders
  • Ignore projects
  • Unlink maven projects
  • Open 'settings.xml'
  • Create 'profiles.xml'
  • Download sources
  • Download documentation
  • Download sources and documentation
  • Show effective pom
  • Show diagram
  • Show diagram popup
 
 
Get updates on questions and answers
 
  •  
    Going to ask the obvious question: why haven't you tried to remove the dependency from the POM directly? (Project Structure is built off of the POM, so it'd likely be recreated if you just deleted it from there within IntelliJ.) 
    – Makoto
     Jan 22, 2021 at 16:59
  •  
    I did, sorry if that wasn't clear in my question. Please see my edit   Jan 22, 2021 at 17:12
  •  
    You need to reimport inside IntelliJ. If you changed the POM, there should be refresh button hovering in the upper-right corner of the pom.xml, and otherwise you can reimport from the Maven tab.   Jan 22, 2021 at 17:56 

2 Answers

1
 

You can go to your Maven repository: .m2/com/company/digital/fmk Delete jar files Rerun command, it will download dependencies again.

 
0

Right click on project -> maven -> sync shall do the trick previous versions did this by default on changes in pom.xml now it seems to be not available anymore

 
posted @ 2023-02-11 07:30  功夫 熊猫  阅读(28)  评论(0编辑  收藏  举报