Matthew Smith
Matthew Smith

Reputation: 1287

Scala, Play2.0 - Expected ';' but found ')'

This seems to be a common theme for newbie Scala programmers like myself...

val main = PlayProject(appName, appVersion, appDependencies).settings(defaultJavaSettings:_*).settings(
    resolvers += Resolver.file("private") artifacts "C:/java/repository/[organisation]/[module]/[revision]/[artifact].[ext]" ivys "C:/java/repository/[organisation]/[module]/ivy-[revision].xml"
    resolvers += Resolver.url("public") artifacts "https://foo.com/ivy-repository/[organisation]/[module]/[revision]/[artifact].[ext]" ivys "https://foo.com/ivy-repository/[organisation]/[module]/ivy-[revision].xml"
)

These two lines together produce the error:

[error] C:\java\play-2.0-beta\base\project\Build.scala:16: ')' expected but '.' found.
[error]         resolvers += Resolver.url("webster") artifacts "https://dev.blackrock.com/ivy-repository/[organisation]/[module]/[revision]/[artifact].[ext]" ivys "https://dev.blackrock.com/ivy-repository/[organisation]/[module]/ivy-[revision].xml"
[error]                              ^
[error] C:\java\play-2.0-beta\base\project\Build.scala:17: ';' expected but ')' found.
[error]     )
[error]     ^
[error] two errors found

If I remove one line, it works, doesn't matter which one. Changing the order of the lines makes no difference.

Can anyone steer me right?

Upvotes: 3

Views: 1736

Answers (4)

meiwin
meiwin

Reputation: 140

You simply missed comma between first and second resolvers

val main = PlayProject(appName, appVersion, appDependencies).settings(defaultJavaSettings:_*).settings(
      resolvers += Resolver.file("private") artifacts "C:/java/repository/[organisation]/[module]/[revision]/[artifact].[ext]" ivys "C:/java/repository/[organisation]/[module]/ivy-[revision].xml"
    , resolvers += Resolver.url("public") artifacts "https://foo.com/ivy-repository/[organisation]/[module]/[revision]/[artifact].[ext]" ivys "https://foo.com/ivy-repository/[organisation]/[module]/ivy-[revision].xml"
)

Upvotes: 0

Régis
Régis

Reputation: 8939

Do not forget to skip lines between resolvers.

Upvotes: 0

Daniel C. Sobral
Daniel C. Sobral

Reputation: 297155

The problem here is that results += .... is a parameter. What you wrote is, essentially, this:

val main = PlayProject(...).settings(a b)

What you should have written is this:

val main = PlayProject(...).settings(a, b) // put in a comma!

Though you could also have written this:

val main = PlayProject(appName, appVersion, appDependencies).settings(defaultJavaSettings:_*).settings(
  resolvers ++= Seq(
    Resolver.file("private") artifacts "C:/java/repository/[organisation]/[module]/[revision]/[artifact].[ext]" ivys "C:/java/repository/[organisation]/[module]/ivy-[revision].xml",
    Resolver.url("public") artifacts "https://foo.com/ivy-repository/[organisation]/[module]/[revision]/[artifact].[ext]" ivys "https://foo.com/ivy-repository/[organisation]/[module]/ivy-[revision].xml"
  )
)

Upvotes: 6

Matthew Smith
Matthew Smith

Reputation: 1287

Chaining two calls to settings fixed the problem.

val main = PlayProject(appName, appVersion, appDependencies).settings(defaultJavaSettings:_*).settings(
    resolvers += Resolver.file("private") artifacts "C:/java/repository/[organisation]/[module]/[revision]/[artifact].[ext]" ivys "C:/java/repository/[organisation]/[module]/ivy-[revision].xml"
).settings(
    resolvers += Resolver.url("public") artifacts "https://foo.com/ivy-repository/[organisation]/[module]/[revision]/[artifact].[ext]" ivys "https://foo.com/ivy-repository/[organisation]/[module]/ivy-[revision].xml"
)

Upvotes: 1

Related Questions