Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading a plugin from a local directory that depends on the resolver at build and run time crashes SBT #44

Open
danielkza opened this issue Feb 4, 2018 · 2 comments

Comments

@danielkza
Copy link

danielkza commented Feb 4, 2018

I am defining settings to be shared among multiple separate SBT projects in a custom plugin. That plugin sets up an S3 repository so that the other projects don't need to.

The custom plugin itself also depends on the S3 resolver for it's own build. Therefore, it contains two references to the S3 resolver, one in project/plugins.sbt and another in build.sbt.

Projects that make use of the custom plugin get it from a Git repository. Hence, it is always loaded as a project dependency, and not a pre-compiled JAR.

When starting any of the projects that use the custom plugin, SBT crashes with the following stack trace. Removing the custom plugin build-time dependency on the resolver (on project/plugins.sbt) fixes the crash. Using a version of the S3 resolver older than 0.12 fixes the crash (probably because that's when the custom credential provider was added).

I'm using SBT 0.13.16. I set up a repository that can reproduce the issue here by just starting sbt at its root: https://github.com/danielkza/fm-sbt-s3-resolver-bug-repro

[info] Installing the s3:// URLStreamHandler via java.net.URL.setURLStreamHandlerFactory
[info] Creating a new Ivy URLHandlerDispatcher to handle s3:// URLs
java.lang.RuntimeException: root/.:.::S3CredentialsProvider is undefined.
	at scala.sys.package$.error(package.scala:27)
	at sbt.Extracted$$anonfun$getOrError$2.apply(Extracted.scala:96)
	at sbt.Extracted$$anonfun$getOrError$2.apply(Extracted.scala:96)
	at scala.Option.getOrElse(Option.scala:120)
	at sbt.Extracted.getOrError(Extracted.scala:96)
	at sbt.Extracted.get(Extracted.scala:21)
	at fm.sbt.S3ResolverPlugin$$anonfun$projectSettings$3$$anonfun$apply$8.apply(S3ResolverPlugin.scala:117)
	at fm.sbt.S3ResolverPlugin$$anonfun$projectSettings$3$$anonfun$apply$8.apply(S3ResolverPlugin.scala:78)
	at scala.Function1$$anonfun$andThen$1.apply(Function1.scala:55)
	at sbt.Project$.setProject(Project.scala:341)
	at sbt.Load$.buildPluginDefinition(Load.scala:887)
	at sbt.Load$.buildPlugins(Load.scala:852)
	at sbt.Load$.plugins(Load.scala:840)
tpunder added a commit that referenced this issue Jul 3, 2018
…son then fallback to the S3URLHandler.defaultCredentialsProviderChain.

This addresses the crash in #44 but may or may not fix the root cause.
@tpunder
Copy link
Owner

tpunder commented Jul 3, 2018

This may or may not fix the problem: 295d6ad

@tpunder
Copy link
Owner

tpunder commented Jul 3, 2018

The "fix" was released as version 0.16.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants