想知道是否有针对主题行错误的解决方案。直到几天之前,build.sbt as-is没有任何改变的魅力。这是关注构建设置的代码段(项目有宏和核心):
lazy val ScalamacrosVersion = "2.0.0-96-9f738df2"
lazy val macroSettings: Seq[Def.Setting[_]] = Seq(
name := "gBoxCPCommonsMacros",
organization := "me.ganaakruti",
version := "1.0",
addCompilerPlugin("org.scalamacros" %% "paradise" % "2.1.0" cross CrossVersion.full),
addCompilerPlugin("org.scalamacros" % "scalac-plugin" % ScalamacrosVersion cross CrossVersion.full),
scalacOptions += "-Xplugin-require:macroparadise",
scalacOptions in (Compile, console) := Seq(),
sources in (Compile, doc) := Nil,
//macro paradise plug-in doesn't work in REPL yet.
scalacOptions in (Compile, console) ~= (_ filterNot (_ contains "paradise")),
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-reflect" % "2.12.3",
"ch.qos.logback" % "logback-classic" % "1.1.3"
)
)
这里是异常跟踪(尝试过存储库更改,但没有结果)。似乎scalac repo的链接失败了。链接让我得到404.有什么想法吗?:
sbt clean compile test:compile
[info] Loading project definition from /gdev/gboxcp/gBoxCPCommons/project
[info] Set current project to root (in build file:/gdev/gboxcp/gBoxCPCommons/)
[info] Executing in batch mode. For better performance use sbt's shell
[success] Total time: 0 s, completed Apr 29, 2018 11:27:25 PM
[info] Updating {file:/gdev/gboxcp/gBoxCPCommons/}macros...
[info] Updating {file:/gdev/gboxcp/gBoxCPCommons/}root...
[info] Resolving org.scalamacros#scalac-plugin_2.12.3;2.0.0-96-9f738df2 ...
[warn] module not found: org.scalamacros#scalac-plugin_2.12.3;2.0.0-96-9f738df2
[warn] ==== local: tried
[warn] /home/kalyan/.ivy2/local/org.scalamacros/scalac-plugin_2.12.3/2.0.0-96-9f738df2/ivys/ivy.xml
[warn] ==== public: tried
[warn] https://repo1.maven.org/maven2/org/scalamacros/scalac-plugin_2.12.3/2.0.0-96-9f738df2/scalac-plugin_2.12.3-2.0.0-96-9f738df2.pom
[warn] ==== local-preloaded-ivy: tried
[warn] /home/kalyan/.sbt/preloaded/org.scalamacros/scalac-plugin_2.12.3/2.0.0-96-9f738df2/ivys/ivy.xml
[warn] ==== local-preloaded: tried
[warn] file:////home/kalyan/.sbt/preloaded/org/scalamacros/scalac-plugin_2.12.3/2.0.0-96-9f738df2/scalac-plugin_2.12.3-2.0.0-96-9f738df2.pom
[info] Resolving jline#jline;2.14.4 ...
[info] downloading https://repo1.maven.org/maven2/org/scala-lang/scala-library/2.12.3/scala-library-2.12.3.jar ...
[info] [SUCCESSFUL ] org.scala-lang#scala-library;2.12.3!scala-library.jar (1626ms)
[info] downloading https://repo1.maven.org/maven2/org/scala-lang/scala-reflect/2.12.3/scala-reflect-2.12.3.jar ...
[info] [SUCCESSFUL ] org.scala-lang#scala-reflect;2.12.3!scala-reflect.jar (1066ms)
[info] downloading https://repo1.maven.org/maven2/ch/qos/logback/logback-classic/1.1.3/logback-classic-1.1.3.jar ...
[info] [SUCCESSFUL ] ch.qos.logback#logback-classic;1.1.3!logback-classic.jar (269ms)
[info] downloading https://repo1.maven.org/maven2/ch/qos/logback/logback-core/1.1.3/logback-core-1.1.3.jar ...
[info] [SUCCESSFUL ] ch.qos.logback#logback-core;1.1.3!logback-core.jar (324ms)
[info] downloading https://repo1.maven.org/maven2/org/slf4j/slf4j-api/1.7.7/slf4j-api-1.7.7.jar ...
[info] [SUCCESSFUL ] org.slf4j#slf4j-api;1.7.7!slf4j-api.jar (217ms)
[info] downloading https://repo1.maven.org/maven2/org/scalamacros/paradise_2.12.3/2.1.0/paradise_2.12.3-2.1.0.jar ...
[info] [SUCCESSFUL ] org.scalamacros#paradise_2.12.3;2.1.0!paradise_2.12.3.jar (262ms)
[info] downloading https://repo1.maven.org/maven2/org/scala-lang/scala-compiler/2.12.3/scala-compiler-2.12.3.jar ...
[info] [SUCCESSFUL ] org.scala-lang#scala-compiler;2.12.3!scala-compiler.jar (2696ms)
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: org.scalamacros#scalac-plugin_2.12.3;2.0.0-96-9f738df2: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Unresolved dependencies path:
[warn] org.scalamacros:scalac-plugin_2.12.3:2.0.0-96-9f738df2 ((sbt.BuildExtra) Defaults.scala#L2082)
[warn] +- me.ganaakruti:gboxcpcommonsmacros_2.12:1.0
[info] Resolving jline#jline;2.14.4 ...
[info] Done updating.
sbt.ResolveException: unresolved dependency: org.scalamacros#scalac-plugin_2.12.3;2.0.0-96-9f738df2: not found
at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:313)
at sbt.IvyActions$$anonfun$updateEither$1.apply(IvyActions.scala:191)
at sbt.IvyActions$$anonfun$updateEither$1.apply(IvyActions.scala:168)
at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:156)
at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:156)
at sbt.IvySbt$$anonfun$withIvy$1.apply(Ivy.scala:133)
at sbt.IvySbt.sbt$IvySbt$$action$1(Ivy.scala:57)
at sbt.IvySbt$$anon$4.call(Ivy.scala:65)
at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:95)
at xsbt.boot.Locks$GlobalLock.xsbt$boot$Locks$GlobalLock$$withChannelRetries$1(Locks.scala:80)
at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:99)
at xsbt.boot.Using$.withResource(Using.scala:10)
at xsbt.boot.Using$.apply(Using.scala:9)
at xsbt.boot.Locks$GlobalLock.ignoringDeadlockAvoided(Locks.scala:60)
at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:50)
at xsbt.boot.Locks$.apply0(Locks.scala:31)
at xsbt.boot.Locks$.apply(Locks.scala:28)
at sbt.IvySbt.withDefaultLogger(Ivy.scala:65)
at sbt.IvySbt.withIvy(Ivy.scala:128)
at sbt.IvySbt.withIvy(Ivy.scala:125)
at sbt.IvySbt$Module.withModule(Ivy.scala:156)
at sbt.IvyActions$.updateEither(IvyActions.scala:168)
at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1541)
at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1537)
at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$121.apply(Defaults.scala:1572)
at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$121.apply(Defaults.scala:1570)
at sbt.Tracked$$anonfun$lastOutput$1.apply(Tracked.scala:37)
at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1575)
at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1569)
at sbt.Tracked$$anonfun$inputChanged$1.apply(Tracked.scala:60)
at sbt.Classpaths$.cachedUpdate(Defaults.scala:1592)
at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1519)
at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1471)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
at sbt.std.Transform$$anon$4.work(System.scala:63)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
at sbt.Execute.work(Execute.scala:237)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
[error] (macros/*:update) sbt.ResolveException: unresolved dependency: org.scalamacros#scalac-plugin_2.12.3;2.0.0-96-9f738df2: not found
[error] Total time: 10 s, completed Apr 29, 2018 11:27:35 PM
答案 0 :(得分:0)
一个解决方法是手动将插件jar放在source的baseDirectory中的custom_lib下,并分配给build.sbt中的scalacOptions。这是摘录:
//Unmanaged base - brings custom libraries into the app path scope
unmanagedBase := baseDirectory.value / "custom_lib"
....
lazy val macroSettings: Seq[Def.Setting[_]] = Seq(
name := "gBoxCPCommonsMacros",
organization := "me.ganaakruti",
version := "1.0",
addCompilerPlugin("org.scalamacros" %% "paradise" % "2.1.0" cross CrossVersion.full),
scalacOptions += "-Xplugin-require:macroparadise",
scalacOptions += s"-Xplugin:$unmanagedBase/scalac-plugin_2.12.3-2.0.0-96-9f738df2.jar",
scalacOptions in (Compile, console) := Seq(),
sources in (Compile, doc) := Nil,
//macro paradise plug-in doesn't work in REPL yet.
scalacOptions in (Compile, console) ~= (_ filterNot (_ contains "paradise")),
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-reflect" % "2.12.3",
"ch.qos.logback" % "logback-classic" % "1.1.3"
)
)
但是,在某些时候,我想回过头来使用存储库链接,就像之前的工作一样。不确定是否需要重新访问lib依赖项。希望借鉴其他人的经验。目前,已经过了构建问题。