编写第一个sbt 0.13的插件,并尝试遵循https://www.scala-sbt.org/0.13/docs/Testing-sbt-plugins.html。 一切都按广告进行,直到进行到步骤5。它打印消息“正在运行... /简单”,并且永远不会从那里继续前进:
build/sbt -Dplugin.version=0.14.8
Detected CYGWIN environment
Reading sbt jar from: build/sbt-launch-0_13_9.jar
[info] Loading project definition from project\home\dir\sheep-metadata-plugin\project
[info] Updating {file:/project/home/dir/sheep-metadata-plugin/project/}sheep-metadata-plugin-build...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Set current project to sheep_metadata (in build file:/project/home/dir/sheep-metadata-plugin/)
> set scriptedBufferLog := false
[info] Defining sheep_metadata/*:scriptedBufferLog
[info] The new value will be used by sheep_metadata/*:scripted
[info] Reapplying settings...
[info] Set current project to sheep_metadata (in build file:/project/home/dir/sheep-metadata-plugin/)
> scripted
[info] :: delivering :: com.myco.sheep.sbt#metadata;0.0.1-SNAPSHOT :: 0.0.1-SNAPSHOT :: integration :: Mon Dec 10 15:11:00 EST 2018
[info] delivering ivy file to project\home\dir\sheep-metadata-plugin\metadata\target\sbt-0.13\ivy-0.0.1-SNAPSHOT.xml
[info] Packaging project\home\dir\sheep-metadata-plugin\metadata\target\sbt-0.13\metadata-0.0.1-SNAPSHOT.jar ...
[info] Done packaging.
[info] published metadata to myHomeDir\.ivy2\local\com.myco.sheep.sbt\metadata\scala_2.10\sbt_0.13\0.0.1-SNAPSHOT\jars\metadata.jar
[info] published metadata to myHomeDir\.ivy2\local\com.myco.sheep.sbt\metadata\scala_2.10\sbt_0.13\0.0.1-SNAPSHOT\srcs\metadata-sources.jar
[info] published metadata to myHomeDir\.ivy2\local\com.myco.sheep.sbt\metadata\scala_2.10\sbt_0.13\0.0.1-SNAPSHOT\docs\metadata-javadoc.jar
[info] published ivy to myHomeDir\.ivy2\local\com.myco.sheep.sbt\metadata\scala_2.10\sbt_0.13\0.0.1-SNAPSHOT\ivys\ivy.xml
Running sheep-metadata-plugin / simple
主要项目的构建工作:
build/sbt -Dplugin.version=0.14.8 clean update compile
但是当我尝试教程中的第5步(即运行scripted
)时,没有错误消息,但也没有成功-它永远不会终止。
更新:在Windows 7 + Babun Cygwin上,我没有收到任何错误消息。在Linux上,即使我按照指示通过了sbt,sbt也抱怨plugin.version
。
[info] java.lang.RuntimeException: The system property 'plugin.version' is not defined.
[info] Specify this property using the scriptedLaunchOpts -D.
我该如何解决?
答案 0 :(得分:0)
修正/澄清/找到解决方法:
首先,让我们澄清一下,https://www.scala-sbt.org/0.13/docs/Testing-sbt-plugins.html中引用的assembly
插件必须添加到simple
项目中,而不是主项目中。
接下来,我放弃了通过命令行参数设置sbt-assembly
版本号,而直接指定了它
sheep-metadata-plugin\metadata\src\sbt-test\sheep-metadata-plugin\simple\project\plugins.sbt
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.8")
最好知道是否有人按照教程中的说明弄清楚该示例如何工作。