3

对于像我这样的新手 Scala 程序员来说,这似乎是一个共同的主题......

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"
)

这两行一起产生错误:

[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

如果我删除一行,它会起作用,不管是哪一行。更改行的顺序没有区别。

任何人都可以引导我正确吗?

4

4 回答 4

6

这里的问题是这results += ....是一个参数。你写的基本上是这样的:

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

你应该写的是这样的:

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

虽然你也可以这样写:

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"
  )
)
于 2011-12-21T20:27:01.037 回答
1

将两个调用链接到设置解决了这个问题。

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"
)
于 2011-12-21T16:59:25.630 回答
0

您只是错过了第一个和第二个解析器之间的逗号

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"
)
于 2012-11-30T14:47:35.563 回答
0

不要忘记在解析器之间跳过行。

于 2012-11-30T13:42:34.317 回答