A custom task in SBT

I want to generate a list of dependancies automatically while doing the compile of a sub-module in a multiproject sbt build.
Basically I need to execute dependencyTree::toFile dependancy.txt -f
Not able to configure it in build.sbt

lazy val inventory-impl = (project in file(“inventory-impl”))
.enablePlugins(LagomJava, JavaAgent)
.settings(common,Dependencies.kamonSettings)
.settings(
libraryDependencies ++= Seq(
lombok
)
)
.settings(lagomForkedTestSettings)
.dependsOn(inventory-api)