scalacenter / scalafix

Refactoring and linting tool for Scala

Home Page:https://scalacenter.github.io/scalafix/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Intellij sbt shell repeatedly warns of "Unrecognized repository"

ashleymercer opened this issue · comments

I have a multi-project sbt build and I've recently added some custom scalafix rules in-tree using the instructions here

When I run any scalafix commands in IntelliJ's sbt shell, I get hundreds (no exaggeration) of warnings that all say
(EDIT: actually this happens even when running unrelated commands like compile or test)

[warn] Unrecognized repository Scala Plugin Bundled Repository, ignoring it

This is mildly frustrating since it completely swamps the "real" output of the shell and makes it hard to find any actual problems.

Thanks for reporting! Did you try asking on the Scala plugin discord or reporting an issue with Jetbrains?

The discord link is here https://discord.gg/aUKpZzeHCK

Ahh yes good point, having done some more digging - this only happens in IntelliJ's sbt shell, and not when using regular command-line sbt. I've cross-posted to their bug tracker:

https://youtrack.jetbrains.com/issue/IDEA-337146/sbt-projects-using-scalafix-repeatedly-warn-of-Unrecognized-repository

Per this commit, it looks like the issue arise when the IntelliJ sbt plugin is injected into a project using sbt-coursier, and is fixed in recent 2023.3.x IntelliJ versions.

I confirm that users of IntelliJ < 2023.3.2 running projects with ScalafixTestkitPlugin are impacted through the usage of includePluginResolvers.

I am still trying to figure out what's going on. Until then, this workaround seems to work for https://github.com/ashleymercer/scalafix-issue-1887:

ThisBuild / includePluginResolvers := false

I am still trying to figure out what's going on.

  • it looks like there are different code paths for the build and the metabuild (coursier vs ivy?)
  • by construction, includePluginResolvers := true exposes the plugin resolver added by the IntelliJ sbt plugin to a code path not exercised in the default case: the build one, driven by lm-coursier-shaded as published by sbt-coursier
  • the plugin resolver, as declared before IntelliJ 2023.3.2, was not valid for that code path, generating the warning in all update tasks of the build (without any impact as the resolver is only needed in the metabuild)

I'll close this as this is fixed in the latest IntelliJ version, and there is a workaround above for the older ones. Thanks again for the report, feel free to reopen if my analysis is wrong.

Awesome detective work @bjaglin - thanks!

Yes can confirm this is fixed in the EAP builds of 2023.3 so happy for this to be closed.