Build.scala, % 和 %% 符号含义 [英] Build.scala, % and %% symbols meaning
问题描述
我是 Play 的新手!Framework 2.1(java 版)并且没有使用 scala 的经验.我不明白在 Build.scala 中 %
和 %%
是什么以及什么意思.我用谷歌搜索了它们,但找不到它们的含义.
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.
在我的 Build.scala 文件中,我有:
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?
推荐答案
来自官方文档:
http://www.playframework.com/documentation/2.1.1/SBTDependencies
使用 %%
如果你使用groupID %% artifactID % revision
而不是groupID % artifactID % revision
(区别在于后面的双%%
groupID
),SBT 会将您项目的 Scala 版本添加到工件中姓名.这只是一个捷径.
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"
)
假设您构建的 scalaVersion
是 2.9.1
,以下是相同的:
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.
这篇关于Build.scala, % 和 %% 符号含义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!