Character Values ​​Build.scala,% and %%

I'm new to Play! Framework 2.1 (Java version) and have no experience with scala. I do not understand what is and what means % and %% in Build.scala. I searched for them, but could not 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 is the first line using one% character and the second using two percent %% characters? What are they needed for?

+86
Jul 04 '13 at 3:37 on
source share
2 answers

From the official documentation:

http://www.playframework.com/documentation/2.1.1/SBTDependencies

Getting the correct version of Scala with %%

If you use groupID %% artifactID % revision instead of groupID % artifactID % revision (the difference is double %% after groupID ), SBT will add your Scala projects to the artifact name. This is just a shortcut.

You can write this without %% :

 val appDependencies = Seq( "org.scala-tools" % "scala-stm_2.9.1" % "0.3" ) 

Assuming scalaVersion for your build 2.9.1 , the following:

 val appDependencies = Seq( "org.scala-tools" %% "scala-stm" % "0.3" ) 

As you can see above, if you use %% , you do not need to specify the version.

+107
Jul 04 '13 at 3:48
source share

This is the part of SBT that the game uses as a building tool. In particular, it is an import statement.

The percent symbol % is actually the method used to create the dependencies. The double percent sign %% introduces the current version of Scala - this allows you to get the right library for the version of Scala that you are using. This is necessary so as not to change the build file when updating Scala.

More info here

+15
Jul 04 '13 at 3:46
source share



All Articles