Jake
Jake

Reputation: 4660

sbt assembly: Exclude resources with MergeStrategy (multi-project build)

I have a multi-project sbt build.

I am in the sbt console in a sub-project.`

In the src/main/resources directory of this sub-project, I have a file: tonglu.conf

I have tried all the following merge strategies. None of them exclude the file. It still appears in the root of the assembly jar

 assemblyMergeStrategy in assembly := {
    case PathList("src", "main", "resources", xs @ _*) => MergeStrategy.discard
    case PathList(ps @ _*) if ps.last endsWith ".html"=> MergeStrategy.first
    case PathList(ps @ _*) if ps.last endsWith "Log.class" => MergeStrategy.first

    case PathList("tonglu.conf", ps @ _*)   => MergeStrategy.discard
    case PathList(ps @ _*) if ps.last endsWith "tonglu.conf" => MergeStrategy.discard
    case PathList(ps @ _*) if ps  contains "tonglu.conf"  => MergeStrategy.discard
    case PathList(ps @ _*) if ps.toString()  contains "tonglu.conf"                   => MergeStrategy.discard
    case x => MergeStrategy.first

NOTE: I would happily remove the resources folder altogether

Upvotes: 1

Views: 469

Answers (1)

Jake
Jake

Reputation: 4660

My error must have been elsewhere. The following line works:

case PathList(ps @ _*) if ps.last endsWith "tonglu.conf"                        => MergeStrategy.discard

Upvotes: 1

Related Questions