15

What these phrases mean:

xs @ _*

ps @ _*

Copied from documentation:

assemblyMergeStrategy in assembly := {
  case PathList("javax", "servlet", xs @ _*)         => MergeStrategy.first
  case PathList(ps @ _*) if ps.last endsWith ".html" => MergeStrategy.first
  case "application.conf"                            => MergeStrategy.concat
  case "unwanted.txt"                                => MergeStrategy.discard
  case x =>
    val oldStrategy = (assemblyMergeStrategy in assembly).value
    oldStrategy(x)
}
Community
  • 1
  • 1
Aleks Ya
  • 859
  • 5
  • 15
  • 27

2 Answers2

13

In your example _* means everything, @ for matching

xs @ _* is case pattern means pick every thing that matched for first case /javax/servlet/*

ps @ _* means pick up all that match as /* and with html extension

FaigB
  • 2,271
  • 1
  • 13
  • 22
4

'@' operator is used to bind to variables in pattern matching.

<somevar> : _* is used to unpack varargs as sequence of appropriate type.

In this example ps @ _* tells pattern matching to retrieve varargs from PathList as Sequence of paths.

Jakub Bartczuk
  • 2,317
  • 1
  • 20
  • 27