0

I have a workflow working on an application and one of its libraries that somewhat looks like this:

Make changes to library -> Push library jar to remote Maven repository with no version change -> Pull updated library jar from the remote repo to the downstream app -> Test and make changes to the app and library

But seems like the way IntelliJ indexes and/or caches Maven dependencies is not affected by me running a clean install from the Maven interface. Is there a surefire way to force IntelliJ to discard any cached dependency and reimport, or possibly do it only for a desired library?

Layman
  • 537
  • 3
  • 13

1 Answers1

0

Very likely this has nothing to do with IntelliJ. Since the version number is the same, maven won't re-download your dependency. Try to just delete the dependency locally from the maven repository:

rm -rf ~/.m2/repository/<..path to your library package..>

You could also avoid pushing the library to the remote repository, and test completely locally, by using the library as a local dependency. For this approach, see answers here: How to add local jar files to a Maven project?

Or since you are not effectively changes the library version the right approach would be to use the library project sources as a direct dependency for IDE maven project. For this - add this Maven library project as a new module to existing Maven project: File | New... | Module from Existing Sources... and select pom.xml file of this library project.

Andrey
  • 10,218
  • 10
  • 57
  • 121
bdeo
  • 93
  • 1
  • 9
  • I actually tried that as well and synced on the IntelliJ interface. It did not refresh like one would expect regardless, which to me means it has everything to do with IntelliJ. I also tried experimenting with removing dependencies on the pom.xml and refreshing, with IDE not complaining at all about suddenly missing dependencies which supports this – Layman Aug 06 '20 at 16:02
  • File > Invalidate Caches always seems to help with such IntelliJ issues. – bdeo Aug 06 '20 at 16:34
  • I was hoping for a way to do it for specific cached dependencies – Layman Aug 06 '20 at 21:11