get reference to “child” projects from “parent” in

2019-08-08 09:38发布

问题:

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.



标签: scala sbt