Maven Reload with Dynamic Credentails

Hey everyone,

Dealing with a bit of an annoying issue and hoping someone’s got a clever workaround.

Our Maven repo needs a password via env var and It expires every few hours.

Right now, I’m adding the line export CUSTOM_PASSWORD=$(my-tool-for-password) to my {shell}rc file and then using ${env.CUSTOM_PASSWORD} in settings.xml.

IntelliJ picks it up fine on startup,but when the password expired, I have to restart the whole IDE :pleading_face:

I took a stab at IntelliJ’s experimental JarRepositoryAuthenticationDataProvider (tried to do it like QodanaSpaceJarRepositoryAuthenticationDataProvider.kt), but that also did not work/load.

Also looked at existing plugins that have this need but they just write plain-text password to the settings.xml file which is not the desirable outcome for us https ://plugins.jetbrains.com/plugin/16777-aws-codeartifact–maven.

Even tried a Maven extension codeartifact-maven-extension, but IntelliJ seems to ignore it.

Delegate IDE actions to Maven does not work when doing a maven reload.

So, I’m wondering:

  • Anyone else wrestle with auto-expiring Maven passwords in IntelliJ? How did you solve it?
  • Is there a way to refresh IntelliJ’s environment variables without a full restart? Any APIs for that?
  • Any tips on getting JarRepositoryAuthenticationDataProvider to actually work? Maybe I’m missing something obvious.

Any ideas would be hugely appreciated!

I have tested my ideas on IDEA 2024.1 in case that is relavant