2

I've created my first SBT (1.x) AutoPlugin to add some settings and behavior to projects that use the plugin.

When I publish it locally, everything resolves and works correctly for the projects using the plugin.

However, when I publish the plugin to our private Nexus repository, it fails to resolve for any projects attempting to use it.

I realize that when sbt plugins are published locally, the path is different than 'regular' sbt projects, but they still resolve correctly for projects which use them.

Do I need to publish sbt plugins to a different location within Nexus than our other Scala / SBT-based projects?

And / or, do I need to set up a new resolver for Nexus-hosted SBT plugins?

I know similar questions have been asked previously, but being new to both Nexus and plugin creation, I haven't been able to figure out exactly what I need to do to get the plugin to resolve correctly when publishing to Nexus rather than simply doing a publishLocal and then adding it to the plugins.sbt file of projects meant to use the plugin.

Any assistance would be very much appreciated!

pme
  • 14,156
  • 3
  • 52
  • 95
Timothy Perrigo
  • 723
  • 4
  • 18
  • How looks your resolver code - and where have you put it? (`resolvers += Resolver.url("heroku-sbt-plugin-releases", url("https://dl.bintray.com/heroku/sbt-plugins/"))(Resolver.ivyStylePatterns)` – pme May 24 '18 at 14:20
  • Well, the purpose of the plugin was to add the necessary resolvers / credentials to the projects that use the plugin, but since the plugin itself needs to be resolved, the only way I've been able to do so is to put the resolver and credential path in the project/plugins.sbt, which kind of defeats the purpose! – Timothy Perrigo May 24 '18 at 15:03
  • so the answer is you missed to add the resolver in `project/plugins.sbt`? – pme May 24 '18 at 15:06
  • 1
    The short answer is yes, but one of the properties I was trying to encapsulate in the plugin was the repository location, so unless I'm missing something, it is self-defeating: in order for the projects to use the plugin to get the repository location (for publishing snapshots and releases) would be to use a plugin which requires specifying the repository location in the `plugins.sbt`! If anyone has any ideas on how to get out of this rabbit-hole, I would be extremely grateful! – Timothy Perrigo May 24 '18 at 16:58
  • I'm also looking into this. Maybe you need to publish that plugin to a separate "Ivy" repository? See: https://www.scala-sbt.org/1.x/docs/Proxy-Repositories.html#Proxying+Ivy+Repositories "The most common mistake made when setting up a proxy repository for sbt is attempting to merge both maven and ivy repositories into the same proxy repository. While some repository managers will allow this, it’s not recommended to do so. Even if your company does not use ivy, sbt uses a custom layout to handle binary compatibility constraints of its own plugins." – Etienne Neveu Aug 29 '18 at 14:08

0 Answers0