-
Hello, I am curious how SBT understand which dependencies should be downloaded for com.typesafe.play:sbt-plugin. Could someone help to understand where SBT takes info that it should download all other playframework dependencies? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Lets put aside Play for a moment an lets talk about a plain sbt project: When you want to add a dependency to a sbt project you do that by adding it to the
Now back to Play. Here, like you are correctly said, you add a sbt plugin to your lazy val root = (project in file(".")).enablePlugins(PlayScala) // or PlayJava This enabled plugin now modifies your project settings by e.g. adding dependencies to your playframework/dev-mode/sbt-plugin/src/main/scala/play/sbt/Play.scala Lines 89 to 92 in 9b86046 As you can see it requires another plugin to be loaded: playframework/dev-mode/sbt-plugin/src/main/scala/play/sbt/Play.scala Lines 41 to 44 in 9b86046 PlayWeb now defined projectSettings which are the settings that will be applied onto your project!And this is how these settings look like: playframework/dev-mode/sbt-plugin/src/main/scala/play/sbt/PlaySettings.scala Lines 237 to 271 in 9b86046 These settings are applied to your project like if you would write it yourself into the playframework/dev-mode/sbt-plugin/src/main/scala/play/sbt/PlaySettings.scala Lines 102 to 108 in 9b86046 So the sbt plugin does the job of configuring the project for you, including setting I hope that explains what you are asking for. |
Beta Was this translation helpful? Give feedback.
Lets put aside Play for a moment an lets talk about a plain sbt project: When you want to add a dependency to a sbt project you do that by adding it to the
build.sbt
file. For example if you want to theslf4j-api
dependency to your project you do that by:Now back to Play. Here, like you are correctly said, you add a sbt plugin to your
project/plugins.sbt
file. What you didn't mention is that you have to enable the play plugin in thebuild.sbt
as well doing e.g.:This enabled plugin now modifies your project settings by e.g. adding depe…