sbt/sbt-avro

How does `excludeFilter` work?

Closed this issue · 2 comments

We have been trying and failing to exclude a schema from sbt-avro. Currently we have this in our build.sbt:

(Compile / avroSource) := (Compile / sourceDirectory).value / "resources",
(Compile / avroUnpackDependencies / excludeFilter) := HiddenFileFilter || "target_schema.avsc",

the avroSource folder contains two schemas, source_schema.avsc and target_schema.avsc. They clash, so we only want to generate the source one.

Hi, sorry for the super late reply. Missed the notification :(

If not already solved, I would suspect the filter to not match the file to exclude.
I would try to run first with

avroUnpackDependencies / excludeFilter := { f =>
  val filter: FileFilter =  HiddenFileFilter || "target_schema.avsc"
  val exclude = filter.accept(f)
  println(s"$f: $exclude")
  exclude
}

So we can see the file and the filter result.
You can then tune the filter to product the desired outcome

Closing since not active. Feel free to re-open if support is still needed