Build.scala, % and %% symbols meaning
This is part of SBT which play uses as a build tool. Specifically this is an import statement.
The percent symbol %
is a actually a method used to build dependencies. The double percent sign %%
injects the current Scala version - this allows you to get the correct library for the version of scala you are running. This is to avoid having to change your build file when you update Scala.
More information here
From the official documentation:
http://www.playframework.com/documentation/2.1.1/SBTDependencies
Getting the right Scala version with
%%
If you use
groupID %% artifactID % revision
instead ofgroupID % artifactID % revision
(the difference is the double%%
after thegroupID
), SBT will add your project’s Scala version to the artifact name. This is just a shortcut.You could write this without the
%%
:val appDependencies = Seq( "org.scala-tools" % "scala-stm_2.9.1" % "0.3" )
Assuming the
scalaVersion
for your build is2.9.1
, the following is identical:val appDependencies = Seq( "org.scala-tools" %% "scala-stm" % "0.3" )
As you can see above, if you use %%
, you don't have to specify the
version.