Macro dependancy appearing in POM/JAR

喜欢而已 提交于 2019-12-06 10:24:48

The Build.scala in the linked document is a multi-project build:

import sbt._
import Keys._

object MacroBuild extends Build {
   lazy val main = Project("main", file(".")) dependsOn(macroSub)
   lazy val macroSub = Project("macro", file("macro")) settings(
      libraryDependencies <+= scalaVersion("org.scala-lang" % "scala-compiler" % _)
   )
}

This means that the macro class files will be in another jar, and you have to publish (or publish-local) both your main project and the macro project if other project wants to use it.

> project macro
> publish-local

In your main project definition, you can replace dependsOn(macroSub) with dependsOn(macroSub % "compile-internal"). This won't add the macro project as a dependency to the POM.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!