I'm writing plugin for sbt like sbt-assembly, sbt-pack, etc. I want to get inter-project dependencies (internalDependencyClasspath
or projectDependencies
) and call package
task on this projects and get path to produced artifact. How can i call package
task on other projects? and how can i get references to "child" projects from "parent" project in general?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You can have a look how sbt-native-packager does that
https://github.com/sbt/sbt-native-packager/blob/763c1c837e2f78d00cbfe54fdd07377bb21f9e70/src/main/scala/com/typesafe/sbt/packager/archetypes/JavaApp.scala#L167
Are you sure this plugin won't cover your needs? For me it helps building .tgz archive with run script inside.
Previously I also used plugins you mentioned, but discarded the first (sbt-assembly) because of high build time and didn't actually want to merge everything into single jar, and second (sbt-pack) because it didn't properly resolved transitive dependencies (at least before) and put a lot of duplicates.