Any classes defined in project/*.scala
files are made available for use by SBT inside the build definition code.
I would like those classes to be available
I don't think it is possible, as documented in the SBT documentation
Note: At runtime, all plugins for all builds are loaded in a separate, parent class loader of the class loaders for builds. This means that plugins will not see classes or resources from build definitions.
Based on the comments, I think maybe this solution may work. In the project/
create extra project called scala-style-defs
. There place your rules. In the same project create build.sbt
with the build definition e.g.
libraryDependencies += "org.scalastyle" %% "scalastyle" % "0.4.0"
resolvers += "sonatype-releases" at "https://oss.sonatype.org/content/repositories/releases/"
Then in the project/
create build.sbt with following content
lazy val root = project.in(file(".")) dependsOn(scalastyleDefs)
lazy val scalastyleDefs = Project(id="scalastyleDefs", base=file("scala-style-defs"))
and of course plugins.sbt
with
addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "0.4.0")
resolvers += "sonatype-releases" at "https://oss.sonatype.org/content/repositories/releases/"
Now in your main project create build.sbt
and there include scalastyle settings
org.scalastyle.sbt.ScalastylePlugin.Settings