我创建了一个生成资源的SBT AutoPlugin: https://github.com/sphereio/json-schema-inliner/
(Thx到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
答案 0 :(得分:0)