I have a scala project that uses macros which basically follows the exact method described here (http://www.scala-sbt.org/0.12.4/docs/Detailed-Topics/Macro-Projects.html) including the whole Distribution section (so in essence I have a root project, and a subproject called macro which holds the macros being used)
The problem is, when I publish my project (using publish-local for now), and another scala project uses the one with a macro as a dependency, it tries to pull macro#macro_2.10;0.1-SNAPSHOT since it appears in the POM. This causes project to fail to compile as it can't resolve the dependency, i.e.
> compile
[info] Updating {file:/Users/mdedetrich/silvermanwylie/waitress/}default-0e4b9d...
[info] Resolving macro#macro_2.10;0.1-SNAPSHOT ...
[warn] module not found: macro#macro_2.10;0.1-SNAPSHOT
[warn] ==== local: tried
[warn] /Users/mdedetrich/.ivy2/local/macro/macro_2.10/0.1-SNAPSHOT/ivys/ivy.xml
[warn] ==== public: tried
[warn] http://repo1.maven.org/maven2/macro/macro_2.10/0.1-SNAPSHOT/macro_2.10-0.1-SNAPSHOT.pom
[info] Resolving org.slf4j#slf4j-api;1.6.4 ...
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: macro#macro_2.10;0.1-SNAPSHOT: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[trace] Stack trace suppressed: run last *:update for the full output.
[error] (*:update) sbt.ResolveException: unresolved dependency: macro#macro_2.10;0.1-SNAPSHOT: not found
[error] Total time: 0 s, completed Aug 23, 2013 8:15:56 PM
If I manually remove the dependency from ivy-1.0.0-SNAPSHOT.xml
<dependency org="macro" name="macro_2.10" rev="0.1-SNAPSHOT" conf="compile->default(compile)"/>
In ivy cache then everything works fine (the project compiles and the macro it is using from the dependency works fine)
This is what my Build.scala looks like
import sbt._
import Keys._
object MacroBuild extends Build {
lazy val main = Project("main", file(".")) dependsOn(macroSub) settings(
// include the macro classes and resources in the main jar
mappings in (Compile, packageBin) <++= mappings in (macroSub, Compile, packageBin),
// include the macro sources in the main source jar
mappings in (Compile, packageSrc) <++= mappings in (macroSub, Compile, packageSrc)
)
lazy val macroSub = Project("macro", file("macro")) settings(
scalaVersion:= "2.10.2",
libraryDependencies <+= scalaVersion("org.scala-lang" % "scala-compiler" % _),
publish := {},
publishLocal := {}
)
}
How do I prevent the macro dependency from appearing in the POM?
EDIT: Just to be clear, the issue is not with scala-language or scala-reflect being included as a dependency, the issue is with the main (or root) project depending on the macro sub project when it never actually needs or uses it (since its a macro)