Reputation: 1250
How would one override the libraryDependencies
?
I tried:
Keys.libraryDependencies in Compile := {
val libraryDependencies = (Keys.libraryDependencies in Compile).value
val allLibraries = UpdateDependencies(libraryDependencies)
allLibraries
}
So that seem to work, when I add print statement, the allLibraries
is correct.
However, in the next steps, it doesn't seem to have the right values:
Keys.update in Compile := Def.taskDyn {
val u = (Keys.update in Compile).value
Def.task {
val allModules= u.configurations.flatMap(_.allModules)
log.info(s"Read ${allModules.size} modules:")
u
}
}.value
The print statement only have a few modules instead of all the one I would have added in the previous step.
Anyone have a solution ? Thanks !
Upvotes: 2
Views: 164
Reputation: 1250
So I understand where my problem was.
I was not understanding correctly how settings
and tasks
were working together.
settings
are only evaluated once when sbt
start.
and tasks
are only evaluated once when sbt
start a task / command which will require it.
So you cannot read and then rewrite settings
like that.
It was so convoluted, I even wrote a whole article about it
Upvotes: 1