托管资源仅适用于新清理的项目

managed resource available only for freshly cleaned project

我创建了一个生成资源的 SBT AutoPlugin: https://github.com/sphereio/json-schema-inliner/

(感谢 Why doesn't a custom resourceGenerator get executed upon compile?,我可以解决我的第一个问题。)

例如有一个生成"test/inline/category.schema.json"的测试项目。

测试项目也在GIT:https://github.com/sphereio/json-schema-inliner/tree/master/testProject

此生成的资源可用于新清理的项目:

cd testProject

▶ sbt clean run
[...]
[info] Running Main
url from test/category.schema.json: file:/Users/yannsimon/projects/json-schema/testProject/target/scala-2.10/classes/test/category.schema.json
url from test/inline/category.schema.json: file:/Users/yannsimon/projects/json-schema/testProject/target/scala-2.10/classes/test/inline/category.schema.json

再次运行时,托管资源从"testProject/target/scala-2.10/classes/test/inline"

中消失
▶ sbt run
[...]
[info] Running Main
url from test/category.schema.json: file:/Users/yannsimon/projects/json-schema/testProject/target/scala-2.10/classes/test/category.schema.json
url from test/inline/category.schema.json: null

如有任何帮助,我们将不胜感激。

谢谢,Yann

在 sbt 问题中回答:https://github.com/sbt/sbt/issues/2168#issuecomment-144133794

修复非常简单:https://github.com/sphereio/json-schema-inliner/commit/eeb490189781e93c8c6eb15b504a158ce425b653