heremaps / here-sbt-bom

SBT BOM is the plugin for SBT for dealing with Maven BOM in SBT projects
Other
19 stars 5 forks source link

Unable to download the plugin #6

Closed gaeljw closed 9 months ago

gaeljw commented 9 months ago

Hello folks,

I wanted to try out the plugin but I can't manage to download it.

Even after adding the documented resolver:

ThisBuild / resolvers += Resolver.url("MAVEN_CENTRAL_SBT", url("https://repo.maven.apache.org/maven2"))(Patterns("[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]"))

I get the following error:

[error] (update) lmcoursier.internal.shaded.coursier.error.FetchError$DownloadingArtifacts: Error fetching artifacts:
[error] https://repo1.maven.org/maven2/com/here/platform/sbt-bom_2.12_1.0/1.0.4/sbt-bom_2.12_1.0-1.0.4.jar: not found: https://repo1.maven.org/maven2/com/here/platform/sbt-bom_2.12_1.0/1.0.4/sbt-bom_2.12_1.0-1.0.4.jar

I.e. it's looking for https://repo1.maven.org/maven2/com/here/platform/sbt-bom_2.12_1.0/1.0.4/sbt-bom_2.12_1.0-1.0.4.jar when the real URL is https://repo.maven.apache.org/maven2/com/here/platform/sbt-bom_2.12_1.0/1.0.4/sbt-bom-1.0.4.jar (notice the extra _2.12_1.0 in the JAR name)

I'm not super familiar with the patterns, I don't know if it can be customized to the need. Or maybe the plugin must change its publication settings?

Thanks for any help, looking forward to try using BOM with SBT finally :)

molekyla commented 9 months ago

Hi @gaeljw. Doublecheck that your plugin dependency looks like addSbtPlugin("com.here.platform" % "sbt-bom" % "1.0.4") If so you can compare your project configuration with with one of our examples: https://github.com/heremaps/here-workspace-examples-java-scala/tree/master/location/scala/standalone

If that not helped please provide exaple project to reproduce the issue

gaeljw commented 9 months ago

Hello @molekyla , I was able to make it work using your example project.

However, when upgrading your example project to sbt 1.9.7 (in the build.properties file), it doesn't work anymore and you get the error I was referring to initially.

I believe it's related to sbt 1.9.x changes:

POM consistency of sbt plugin publishing

sbt 1.9.0 publishes sbt plugin to Maven repository in a POM-consistent way. sbt has been publishing POM file of sbt plugins as sbt-something-1.2.3.pom even though the artifact URL is suffixed as sbt-something_2.12_1.0. This allowed "sbt-something" to be registered by Maven Central, allowing search. However, as more plugins moved to Maven Central, it was considered that keeping POM consisntency rule was more important, especially for corporate repositories to proxy them.

sbt 1.9.0 will publish using both the conventional POM-inconsistent style and POM-consistent style so prior sbt releases can still consume the plugin. However, this can be opted-out using sbtPluginPublishLegacyMavenStyle setting.

This talks about publication but I guess it also impacts download: sbt 1.9.x is not able to download a plugin published "the old way".

I think the easiest is likely to upgrade the plugin to be published with sbt 1.9.x.

gaeljw commented 9 months ago

I see that there was an explicit change some time ago to publish the POM under the "old way" name: https://github.com/heremaps/here-sbt-bom/pull/4. I believe this must be removed.