Mark S
Mark S

Reputation: 1453

Is it possible to add a resolver to an SBT project's build via an AutoPlugin?

I am creating an AutoPlugin that wraps a non-auto plugin flywaydb. Unfortunately, the non-auto plugin requires a custom resolver. When I publish our autoplugin, the resolver is not used in the client project's meta build, causing SBT to fail to start with a big stack trace that begins with:

sbt.ResolveException: unresolved dependency: org.flywaydb#flyway-sbt;3.2.1: not found

I did not catch this locally because I had the flyway artifacts cached in ~/.ivy/cache/scala_2.10/sbt_0.13/org.flywaydb/

The error is obviously due to SBT not using the custom flyway resolver when loading the build with the AutoPlugin enabled. My question, is there a way to add a meta build resolver via an AutoPlugin setting? Or is it required that all plugin dependencies must be resolvable via the default SBT resolvers?

A secondary question (could be the real issue): could it be an SBT bug that the client project's meta build does not transitively depend on dependencies of enabled plugins?

This project is OSS. Links to code in case it is helpful:

Here is where the plugin project adds the resolver: https://github.com/allenai/sbt-plugins/blob/a3ea78319836fd39cc8f2e13305e85bb9bfef5c7/build.sbt#L44-L45

Here is the auto plugin: https://github.com/allenai/sbt-plugins/blob/a3ea78319836fd39cc8f2e13305e85bb9bfef5c7/src/main/scala/org/allenai/plugins/DatabasePlugin.scala

Upvotes: 4

Views: 1360

Answers (2)

Arroadie
Arroadie

Reputation: 144

I found out that I was pointing to the wrong resolver, which now is

resolvers += "Flyway" at "https://flywaydb.org/repo"

Upvotes: 2

Eugene Yokota
Eugene Yokota

Reputation: 95624

Unfortunately your build user still needs to put in the resolver setting inside project/*.sbt.

Upvotes: 0

Related Questions