Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ IDEA unable to find credentials for Artifactory

I am using IntelliJ IDEA ultimate to import an SBT project that has some plugins in a private Artifactory.

[info] Resolving com.private#XXXX_X.X;X.X.X-SNAPSHOT ...
[error] Unable to find credentials for [Artifactory Realm @ artifactory-private.com].
[error] Unable to find credentials for [Artifactory Realm @ artifactory-private.com].

I did configure the Artifactory credentials in SBT and is working fine if I build the project using sbt shell; however, build is failing in IntelliJ and is not recognizing the credentials. Can anyone help, please?

Update: It appears that this is the only problem when the plugins are SNAPSHOT versions.

Thank you very much in advance!

like image 873
vkt Avatar asked Nov 06 '22 18:11

vkt


1 Answers

In sbt 1.x, set 3 files:

~/.sbt/repositories

~/.sbt/credentials

~/.sbt/1.0/plugins/credentials.sbt

The first can contain something like this (just an example):

    [repositories]
    local
    maven-local
    my-ivy-proxy-releases1: https://<yourdomain.org>/sbt-scala/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[rev
    ision]/[type]s/[artifact](-[classifier]).[ext]
    my-maven-proxy-releases: https://<yourdomain.org>/maven-release/

The second something like this:

    realm=Artifactory Realm
    host=<yourdomain.org>
    user=<your_user>
    password=<your_pass>

Additionally, you create this file: ~/.sbt/1.0/plugins/credentials.sbt

credentials += Credentials(Path.userHome / ".sbt" / "credentials")

Now, in the console, in your project directory you can do something like this to compile your project using this repositories only.

sbt -Dsbt.override.build.repos
  1. Now, for IntelliJ, you can go to Settings -> Build, Execution, Deployment -> sbt

And in sbt:

VM parameters: "-Dsbt.override.build.repos"

Mark: - Use sbt shell [✓] For imports [✓] For builds

[✓] Allow overriding sbt version [✓] Enable debugging for sbt shell

like image 59
vejeta Avatar answered Nov 14 '22 21:11

vejeta