Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
450 views
in Technique[技术] by (71.8m points)

sbt - 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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...