aws / aws-toolkit-jetbrains

AWS Toolkit for JetBrains - a plugin for interacting with AWS from JetBrains IDEs
https://plugins.jetbrains.com/plugin/11349-aws-toolkit
Apache License 2.0
768 stars 226 forks source link

Using CodeArtifact with Maven from IntelliJ #3181

Open romank8k opened 2 years ago

romank8k commented 2 years ago

Is your feature request related to a problem? Please describe. Maven requires the following configuration in ~/.m2/settings.xml for CodeArtifact:

<server>
      <id>codeartifact</id>
      <username>aws</username>
      <password>${env.CODEARTIFACT_AUTH_TOKEN}</password>
</server>

This requires first exporting the CODEARTIFACT_AUTH_TOKEN like:

export CODEARTIFACT_AUTH_TOKEN=`aws codeartifact get-authorization-token --domain mydomain --query authorizationToken --output text`

And then launching IntelliJ.

Furthermore, since the token only lasts up to 12hours, it's not possible to update this token without re-launching IntelliJ.

Describe the solution you'd like Have the IntelliJ plugin overwrite the value of CODEARTIFACT_AUTH_TOKEN with a fresh token prior to resolving maven artifacts.

Describe alternatives you've considered Another IntelliJ plugin that attempts to solve this by writing the value of the token directly into ~/.m2/settings.xml. https://github.com/coderazzi/aws_codeartifact_maven

Additional context Gracefully handle profiles configured with AWS SSO and/or MFA.

thesurlydev commented 4 months ago

Another workaround is to run mvn clean install or similar from command line to download a local copy of the dependencies. This is still painful and having a seamless integration as outlined above would be great.