scalafix icon indicating copy to clipboard operation
scalafix copied to clipboard

Use rules defined in SBT module within a multi-module build

Open cchantep opened this issue 2 years ago • 2 comments
trafficstars

Currently it's not possible to use rules defined in a SBT modules in other modules of the same multi-modules project without publishing, aka not possible to use inter-module dependencies (e.g. dependsOn).

Local rules are not sufficient neither when rules are to be used accross several sibling modules, nor when the rules module itself needs specific libraryDependencies.

cchantep avatar Jun 19 '23 15:06 cchantep

Hi @cchantep !

By "rule defined in SBT module", I assume you are refering to that scenario (although the other one might be more maintainable if you start sharing rules across projets)?

I might be misinterpreting your request, but considering that local rules rely on a sbt configuration ScalafixConfig / "scalafix", you should already have full flexibility on dependency management.

Local rules are not sufficient neither when rules are to be used accross several sibling modules

You should be able to use service2.dependsOn(service1 % "scalafix->scalafix") (see docs).

nor when the rules module itself needs specific libraryDependencies.

Did you try service1 / libraryDependencies += "external" % "dependency" % "1.0.0" % ScalafixConfig ? (see docs)


Let me know if that helps. If it does, a PR to clarify the docs would be welcome. If it does not, a concrete example would help, to better understand your needs.

bjaglin avatar Jun 24 '23 16:06 bjaglin

Hi @cchantep, any feedback on that?

bjaglin avatar Feb 05 '24 08:02 bjaglin