Play’s Build.scala File- a Very Subtle Gotcha
Join the DZone community and get the full member experience.
Join For FreeWork on the new module repository for Play is progressing nicely, but a very subtle bug was introduced into the Build.scala file. As a result, artifacts from the first repository were not being found. Can you spot the difference here? The first code snippet is correct, and the second is faulty.
val main = PlayProject(appName, appVersion, appDependencies, mainLang = JAVA).settings ( resolvers += Resolver.url("Objectify Play Repository", url("http://schaloner.github.com/releases/"))(Resolver.ivyStylePatterns), resolvers += Resolver.url("Scala Tools", url("http://scala-tools.org/repo-releases/"))(Resolver.ivyStylePatterns) )
val main = PlayProject(appName, appVersion, appDependencies, mainLang = JAVA).settings { resolvers += Resolver.url("Objectify Play Repository", url("http://schaloner.github.com/releases/"))(Resolver.ivyStylePatterns) resolvers += Resolver.url("Scala Tools", url("http://scala-tools.org/repo-releases/"))(Resolver.ivyStylePatterns) }
The problem was caused by using curly brackets instead of parentheses. Note also that when using curly brackets, you can’t put a comma after the first resolver. However, the file still compiles without a problem. Very subtle, very annoying!
So, the correct form is the first snippet above – here with bold to emphasise the key points.
val main = PlayProject(appName, appVersion, appDependencies, mainLang = JAVA).settings ( resolvers += Resolver.url("Objectify Play Repository", url("http://schaloner.github.com/releases/"))(Resolver.ivyStylePatterns), resolvers += Resolver.url("Scala Tools", url("http://scala-tools.org/repo-releases/"))(Resolver.ivyStylePatterns) )
Published at DZone with permission of Steve Chaloner, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments