-
Notifications
You must be signed in to change notification settings - Fork 277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(Randomly) Unresolved scalafmt on version 2.0.0 #1415
Comments
Maybe duplicated of #1399 |
Running into the same problem with As a work-around, we're now using a build cache with the correct version included. |
@GMadorell please try to update sbt plugin to latest version:
|
Problem seems to be gone in 2.0.1/2.0.0-RC8, thanks! |
Update, I am now using both
and
in the scalafmt config file. It is still failing randomly (even with concurrency disabled). |
@tanishiking Do you want me to open another ticket? |
I also experience this, randomly our CI fails with
Rerun usually works. Using sbt-scalafmt 2.0.2 and |
@tanishiking this is still failing by the way, do you want me to open another ticket for this? |
@GMadorell @jgogstad Thank you for the information. Hmm, maybe we need some more investigation... Could you open another ticket? |
This is still an issue. Did you open a ticket @GMadorell ? Just to track the update of this issue. |
Re-opened this issue for tracking on the problem. If anyone has any clues: something like CI results or detailed environment, it would be helpful for tackling this :) |
After fighting with this all day, I've nailed it down to Both plugins work for me locally, even after clearing my cache... I don't know if that helps? |
We are also currently seeing this problem with |
Using bitbucket pipline as a ci env, and getting this issue with scala fmt 2.0.X. |
I also see this both in sbt and intellij. Weirdly, with intellij, it will often work with 2.0.1, but not 2.0.0, 2.0.3 or 2.0.4. |
Also, my unsubstantiated hunch is that this is a coursier bug. I think scalafmt is using a fairly old version of coursier via coursier small? Perhaps it needs an upgrade. |
Is there any chance that this could be related to the current coursier version? |
I wouldn't think so. Scalafmt uses https://github.com/olafurpg/coursier-small to do the downloading and resolution and, according to the readme, coursier-small shades the coursier namespace so it should be using the shaded version of coursier (which is quite old at this point). |
FWIW, there is a pending pull request to use coursier instead of coursier-small: |
One thing we have noticed is:
So could it be possible that what's happening is CI machines getting blacklisted by repo1.maven.org? (If CI build agents start "too fresh" they won't have any locally-cached stuff and so sbt-scalafmt will go to repo1.maven.org to get it, and that'll happen again and again. Could that trigger a blacklist?) For those familiar with coursier-small, could whatever code repo1.maven.org sends back when it's blacklisted someone result in the errors we're all seeing? |
I should definitely keep working on that PR. Currently coursier update in scalafmt blocked by coursier/interface#57. I hope that I can find the time to solve this issue but, anyway, any help is welcome 😄 |
Maybe the authors of the library can provide some workaround instructions for using scalafmt CLI to format main, test, and integration test, until this issue is resolved? Thanks! |
I've faced the same problems with scalafmt. Runs fine on local dev machine (also mac) but fails on Jenkins CI all the time with same error "failed to resolve Scalafmt version". I've tried with a few different versions (incl. 2.0.0, 2.0.1) but it didn't help and issue still occurs. |
Another piece of evidence in favor of my blacklisting theory -- we just ssh'd into one of our CI build agents and tried to do And when we look at the full response the CI agents are getting to that command see the blacklist warning text ( In short, I think the problem is because the coursier embedded in sbt-scalafmt is ignoring the repos that have been configured for sbt via .sbtopts and the like and is just going straight to Maven itself. |
That could certainly be a contributing factor, but I run into this on my local machine quite often. I can’t prove it isn’t, but I doubt my home ip is being rate limited by maven. |
But then, if it was because of blacklisting, wouldn't downloads of other artifacts fail as well? Without scalafmt, or with an older one, the build runs just fine - downloads all dependencies, among other things. |
Well at least for us, all our dependencies are cached in artifactory, so other than scalafmt we are never going to maven directly (and what we see in the coursier cache bears that out) -- the request is to artifactory and it either satisfies the request if it has the artifact or else downloads and caches the artifact). And I'm pretty sure our artifactory is not in the same IP block that the CI build agents are. So a blacklist of the build agents would not affect our artifactory. |
Please try it with sbt-scalafmt v2.0.6. There was coursier update in scalafmt-dynamic. |
Excited! Quick question, will COURSIER_REPOSITORIES env var allow us to overrride coursier-interfaces behavior despite the repositories being set for scalafmt fetch? |
@kanishka-azimi I haven't tried it, but expected behavior is "yes, it should override repositories" |
Same problem. Setting |
@thibaultdelor which version of scalafmt are you using? |
@GMadorell doea this stil reproduce in sbt-scalafmt 2.0.7 ? |
I can confirm on 2.0.7/2.1.1 that However, I would argue sbt-scalafmt is still broken if it doesn't honor the And I can confirm that as of 2.0.7 (and scalafmt 2.1.1) it does not honor the property. |
Alternatively, sbt might consider deprecating sbt.repository.config and standardize on COURSIER_REPOSITORIES. Until a decision emerges there, I would consider this issue complete for now, as there is a decent workaround possible |
@kanishka-azimi I am more than happy with how sbt is working at the moment regarding overriding repos. At the moment, Given the work around and the number of people impacted, I can understand that the priority of this issue might be low. |
@tanishiking I am on 2.0.7/2.1.1. |
Can we talk about |
Might fix the issue with Java 8 builds, error for ref: Expected feature release number in range of 9 to 14, but got: 8 The command "~/bin/install-jdk.sh --target "/home/travis/oraclejdk8" --workspace "/home/travis/.cache/install-jdk" --feature "8" --license "BCL"" failed and exited with 3 during . Edit: Trying to upgrade scalafmt, seems like we're running into the unresolved issue here: scalameta/scalafmt#1415
Might fix the issue with Java 8 builds, error for ref: Expected feature release number in range of 9 to 14, but got: 8 The command "~/bin/install-jdk.sh --target "/home/travis/oraclejdk8" --workspace "/home/travis/.cache/install-jdk" --feature "8" --license "BCL"" failed and exited with 3 during . Edit: Trying to upgrade scalafmt, seems like we're running into the unresolved issue here: scalameta/scalafmt#1415
Let me close this issue for inactivity. |
Also, in project/plugins.sbt
Steps
Run
sbt scalafmtCheck
in our CI pipeline.Problem
Hi! We have upped the version of scalafmt recently and we have since got this problem when trying to check if files are formatted.
We don't really know how to proceed. We have checked github issues and tried everything that came up from Google before trying to post this issue.
It seems that sometimes the scalafmt check fails to resolve the dependency and fails overall with the error explained below.
How could we troubleshoot this?
We get the following error:
failed to resolve Scalafmt version '2.0.0-RC5'
Expectation
Dependency is resolved correctly.
Workaround
Rerunning the build makes it work sporadically.
Notes
.
The text was updated successfully, but these errors were encountered: