Open jiramares opened 2 weeks ago
And now it is not working with artifact proxy with self-signed certificate via https at all. Neither COURSIER_REPOSITORIES
environment variable nor repositories.default
scala-cli config. I don't know what to do :-(
I don't know what to do :-(
Hey, I'll try to tackle this soon (likely won't be this week, however).
I'd suspect something is wrong with the config
sub-command's repositories.*
settings, but COURSIER_REPOSITORIES
is known and proven to be reliable... 😕
Can't tell you much until I take a closer look.
Hi @Gedochao,
I have been a little more investigating and it looks that problem is with https protocol with artifact proxy (not with its setting via COURSIER_REPOSITORIES or repositories.default). I have to restart computer between tests because I can't reset the environment well (killing all java processes have not been enough).
scala-cli
works great with http and https too (for https I have to use -Djavax.net.ssl.trustStore
). But the IDEA is not able to resolve using https at all (not possible to validate server certificate - I have imported it into IDEA's store - it looks like idea is using coursier under the hood too but I can't specify -Djavax.net.ssl.trustStore
). To resolve dependencies is job of IDEA or bloop?
From my point of view it directs to coursier that is run under the hood to resolve artifacts. But when run via scala-cli I can add -Djavax.net.ssl.trustStore
but when run in IDEA it is not possible and therfore not working.
To resolve dependencies is job of IDEA or bloop?
Definitely Scala CLI/Bloop, depending on which dependencies. Both use Coursier under the hood. However, I can't be sure what IDEA does in the background.
From my point of view it directs to coursier that is run under the hood to resolve artifacts. But when run via scala-cli I can add -Djavax.net.ssl.trustStore but when run in IDEA it is not possible and therfore not working.
@jiramares Can you raise a corresponding ticket on the JetBrains issue tracker? (https://youtrack.jetbrains.com/issues) So that we can establish this works as expected on the IDEA side of things.
I have already raised one an the result is - it is not IDEA problem (https://youtrack.jetbrains.com/issue/SCL-22728/scala-cli-project-not-working)](https://youtrack.jetbrains.com/issue/SCL-22728/scala-cli-project-not-working)
But .. who starts the bloop server, from mine point of view it is started by scala-cli and IDEA in calling it via BSP? Therefore if the bloop is responsible for resolving why it is run okay through scala-cli and not running via IDEA? I am confused....
One extra question - have you tried running it in Metals? I just want to confirm this isn't IDEA specific, since from what I understand it works when run outside of IDEA. I'd theorise maybe some coursier instance ran inside of IntelliJ is using a JVM without the cert flag.
I hope we won't end up bouncing this back and forth...
No, I haven't ... be honest don't know how to make it.
Just install Metals into VSC and run scala-cli setup-id .
and open it in VSC? Or it is necessary to do something more?
No, I haven't ... be honest don't know how to make it. Just install Metals into VSC and run
scala-cli setup-id .
and open it in VSC? Or it is necessary to do something more?
Exactly this. plus start the Metals server and check if everything works.
I try to make it but I am sorry not to test it now ... hope to make it this week. j
I have installed metals into VSC and have same result as in IDEA:
024.06.28 15:33:28 INFO BSP server: [error] download error: Caught javax.net.ssl.SSLHandshakeException (PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target) while downloading https://ids/artifactory/repo/org/typelevel/cats-core_3/2.12.0/cats-core_3-2.12.0.pom
Looks like that the -Djavax.net.ssl.trustStore
have to be somehow passed to bloop too...
@jiramares do you use cats within your project?
Yes, because of dylemma.xml-spac
My guess is that we are not adding the certs when downloading sources somehow, but it seems unexpected :thinking:
Versions Scala CLI version: 1.3.2 Scala version (default): 3.4.2
IntelliJ IDEA 2024.1.3 (Ultimate Edition) Build #IU-241.17890.1, built on June 4, 2024
Description We used company artifactory to resolve/cache artefacts. Therefor I have to set up environment varianble
COURSIER_REPOSITORIES
to handle it right. Because we are using self signed certificate on server there is problem with resolving artefacts directly using coursier (upgrades scala-cli, scala or java).I realized that there is config
repositories.default
that seems to me to fulfil the same thing but only for scala-cli (not system wide). So I started using it. It works well but breaks the integration with IDE.After starting using
repositories.default
instead ofCOURSIER_REPOSITORIES
I can't build in IDEA via BSP. In BSP window there has been no tree under the root of project. The problem is with our artifactory server with self signed certificate because using maven central causes everything works fine.To Reproduce
scala-cli config repositories.default ivy2local https://our-server/with-self-signed-certificate/repo --power
test
test.sc
with contentprintln(sum(2, 3))
def sum(a: Int, b: Int) = a + b