首页 > 其他分享 >IntelliJ still using old dependency

IntelliJ still using old dependency

时间:2023-02-11 07:44:30浏览次数:64  
标签:old share Jan dependency sheet using still data se

 

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

 

IntelliJ still using old dependency

Ask Question Asked 2 years ago Modified 2 years ago Viewed 2k times <iframe data-google-container-id="1" data-is-safeframe="true" data-load-complete="true" frameborder="0" height="90" id="google_ads_iframe_/248424177/stackoverflow.com/lb/question-pages_0" marginheight="0" marginwidth="0" scrolling="no" src="https://736094ca3736d7be144aecc800bc3941.safeframe.googlesyndication.com/safeframe/1-0-40/html/container.html" title="3rd party ad content" width="728"></iframe> 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
Share Edit     Get updates on questions and answers   edited Jan 22, 2021 at 17:10     asked Jan 22, 2021 at 16:32 l0r3nz4cc10's user avatar l0r3nz4cc10 1,18766 gold badges2323 silver badges4545 bronze badges
  •   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  – l0r3nz4cc10  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.  – Mark Rotteveel  Jan 22, 2021 at 17:56 
Add a comment

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.

Share Edit   answered Jan 22, 2021 at 17:20 bryantran's user avatar bryantran 2611 bronze badge Add a commen<iframe data-google-container-id="4" data-is-safeframe="true" data-load-complete="true" frameborder="0" height="90" id="google_ads_iframe_/248424177/stackoverflow.com/mlb/question-pages_0" marginheight="0" marginwidth="0" scrolling="no" src="https://736094ca3736d7be144aecc800bc3941.safeframe.googlesyndication.com/safeframe/1-0-40/html/container.html" title="3rd party ad content" width="728"></iframe> 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

Share Edit   answered Jan 22, 2021 at 16:36 Konstantin Pribluda's user avatar Konstantin Pribluda 12.3k11 gold badge2929 silver badges3535 bronze badges

标签:old,share,Jan,dependency,sheet,using,still,data,se
From: https://www.cnblogs.com/kungfupanda/p/17110826.html

相关文章