Problem with aws CodeArtifacts

Answered

Hi, I created an artifact and stored in AWS CodeArtifact.  I added the repository in my build.gradle, including the security configuration, and IntelliJ is not recognizing the packages and clases inside the new artifact.  I applied all the suggestions described in this post https://intellij-support.jetbrains.com/hc/en-us/community/posts/206152879-Gradle-Imports-Are-Not-Recognised, but I still having same problem.  Additionally, when I build the project using gradlew script directly by command line, every thing works fine.

Could you give me a light?

4 comments
Comment actions Permalink

>IntelliJ is not recognizing the packages and clases inside the new artifact.

Do you see the jar for this artifact set up as a dependency for the module in which you use it (see it in File | Project Structure | Modules | <module name> | Dependencies tab:

Does Build | Rebuild action work in IDE?

Does Reload action (invoked in Gradle tool window) complete succesfully?

 

Please provide idea.log (Help | Show Log in ... action) after IDE restart and calling Reload action in Gradle tool window and screenshot for the problem. Thank you.

For uploading you can use https://uploads.jetbrains.com or any file sharing service.

0
Comment actions Permalink

Hi, firstable I want to thank you for your response. I used all your suggestions without having a good result. But I found following:

  • This was my build.gradle file:
plugins {
id 'java'
id 'idea'
}

group 'com.demo'
version '1.0-SNAPSHOT'

repositories {
mavenCentral()
maven {
url 'https://XXXXXX-111122223333.d.codeartifact.us-east-1.amazonaws.com/maven/YYYYYYYY/'
credentials {
username "aws"
password System.env.CODEARTIFACT_AUTH_TOKEN
}
}
}

dependencies {
implementation "com.myPackage:myArtifact:1.0"
}

test {
useJUnitPlatform()
}

What does work?

  • Set CODEARTIFACT_AUTH_TOKEN into gradle.properties file
CODEARTIFACT_AUTH_TOKEN=`aws codeartifact get-authorization-token --domain my_domain --domain-owner 111122223333 --query authorizationToken --output text`
echo "CODEARTIFACT_AUTH_TOKEN=$CODEARTIFACT_AUTH_TOKEN" > gradle.properties
  • In build.gredle replace System.env.CODEARTIFACT_AUTH_TOKEN justo for CODEARTIFACT_AUTH_TOKEN, I mean, use gradle property instead environment variable
  • Problem solved

Thanks a lot !!

1
Comment actions Permalink

Thank you for the information! Could you please advise - did the Reload action and IDE build (Build | Rebuild Project) action complete  successfully when you had this problem (when CODEARTIFACT_AUTH_TOKEN was set only as the OS the environment variable) or you saw the error (when was that error)? Thank you.

FTR: if I set the environment variable in the OS and use it in form of

System.env.TEST_VAR

in build Gradle script in IDE - IDE picks it up.

0
Comment actions Permalink

Hi Andrey,

When I did Reload using IDE action, it didn't fix the problem. Even a export the variable using the terminal in the IDE and then i used the refresh button in the Gradle window and it did not still not working.

0

Please sign in to leave a comment.