Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build.scala, % and %% symbols meaning

I'm new to Play! Framework 2.1 (java version) and have no experience with scala. I don't understand what are and what does % and %% mean in Build.scala. I googled about them but couldn't find their meaning.

In my Build.scala file I have:

"org.hibernate" % "hibernate-entitymanager" % "4.1.0.Final",
"com.typesafe" %% "play-plugins-mailer" % "2.1"

Why the first line uses a single % symbol and the second one uses two percent symbols %%? What are they for?

like image 752
Franco Avatar asked Jul 04 '13 03:07

Franco


People also ask

What does provided mean in build SBT?

sbt file. The “provided” keyword indicates that the dependency is provided by the runtime, so there's no need to include it in the JAR file.

What is the difference between SBT and Maven?

Once you familiarize yourself with how one Maven project builds you automatically know how all Maven projects build saving you immense amounts of time when trying to navigate many projects. On the other hand, SBT is detailed as "An open-source build tool for Scala and Java projects".


1 Answers

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 of groupID % artifactID % revision (the difference is the double %% after the groupID), 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 is 2.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.

like image 178
Mingyu Avatar answered Sep 28 '22 09:09

Mingyu