Joy
Joy

Reputation: 4483

Replacing existing jar in .m2/repository with new jar

I am working on a spring boot application with maven dependency on spring-session-data-redis. I would like to customize the createSession() of MapSession class in spring-sessions.

As this is now not supported in spring-sessions. So I have cloned this spring-sessions repo and customized this according to my requirement. Then I built this and replaced the existing spring-session-data-redis jar in BOOT_INF/lib of my original spring-boot application project with this new spring-session-data-redis jar.

Dependency graph of my original maven project is as follows:

my_project
   |
    +- org.springframework.session:spring-session-data-redis:jar:2.3.0.RELEASE:compile
  
        |  \- org.springframework.session:spring-session-core:jar:2.3.0.RELEASE:compile

Now while I loaded the project in IDE, I am still seeing flow is going to MapSession class in an old spring-sessions-core jar which is located in .m2/repository.

Being new to maven, I don't have much idea how to do this. In this regard, I have gone through this: How to manually install an artifact in Maven 2?. But cannot understand how to fix this. Could anyone please help here? Thanks.

Upvotes: 0

Views: 274

Answers (2)

Gaurav kumar Singh
Gaurav kumar Singh

Reputation: 183

You can use maven install with -U option. Example: mvn clean install -U

-U (--update-snapshots) 
    Forces a check for updated releases and snapshots on remote repositories

More such useful options

Upvotes: 1

DV82XL
DV82XL

Reputation: 6639

Delete the entire maven .m2/reoository folder from your ${user.home} folder. Then run mvn clean install to redownload all the latest dependencies.

Upvotes: 1

Related Questions