-
Notifications
You must be signed in to change notification settings - Fork 344
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
Add note about sbtPluginPublishLegacyMavenStyle #1164
Conversation
src/reference/02-DetailTopics/05-Plugins-and-Best-Practices/02-Plugins.md
Outdated
Show resolved
Hide resolved
src/reference/02-DetailTopics/05-Plugins-and-Best-Practices/02-Plugins.md
Outdated
Show resolved
Hide resolved
Sbt plugins can be published as any other projects. | ||
|
||
However, there is one caveat if you attempt to publish your plugin to a repository that follows the Maven scheme. | ||
For many years, Sbt plugins have utilized an artifact layout that is incompatible with Maven-based repositories, and rectifying this in a fully compatible manner has proven to be quite challenging. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For many years, Sbt plugins have utilized an artifact layout that is incompatible with Maven-based repositories, and rectifying this in a fully compatible manner has proven to be quite challenging. | |
For many years, sbt plugins have utilized an artifact layout that is incompatible with Maven-based repositories, and rectifying this in a fully compatible manner has proven to be quite challenging. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like this sentence is simultaneously too much detail for someone who might be interested in creating a new plugin, and not enough details to accurate capture the problem with pre-1.9 publishing. I don't know if it's clear what was "incompatible" with what, for instance. Maven Central has allowed sbt to publish, and sbt versions going back for many years sbt using either Ivy or Coursier was able to resolve plugins out of Maven Central, so it was compatible in that sense.
The problem with pre-1.9 sbt was that it published in a compatible, but intentionally invalid URL such as https://repo1.maven.org/maven2/com/eed3si9n/sbt-assembly_2.12_1.0/2.1.4/sbt-assembly-2.1.4.pom because the artifactId
of the module is called sbt-assembly:
<artifactId>sbt-assembly</artifactId>
This was a workaround to preserve the name
from sbt as artifactId
, while allowing Apache Ivy to find the _2.12_1.0
variant of sbt-assembly from a Maven repository. In an Ivy-layout repository, this concept is expressed as extra attributes, and therefore sbt team has initially recommended hosting sbt plugins on Ivy repository on Artifactory or Bintray. Preserving the name of module allows sbt to round-trip the POM back to our idea of modules, but also it has allowed external services such as https://search.maven.org/search?q=sbt-assembly to treat sbt-assembly as "sbt-assembly", not "sbt-assembly_2.12_1.0" etc.
This invalidity have been ok, apart from the fact that Artifactory has a checkbox called "Suppress POM Consistency Checks", and tried to enforce consistency of the URL layout. Post-1.9 sbt will double-publish to https://repo1.maven.org/maven2/com/eed3si9n/sbt-assembly_2.12_1.0/2.1.4/sbt-assembly_2.12_1.0-2.1.4.pom so the URL as well as the artifactId
are now valid:
<artifactId>sbt-assembly_2.12_1.0</artifactId>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I decided to drop this sentence as it indeed wasn't bringing much value.
src/reference/02-DetailTopics/05-Plugins-and-Best-Practices/02-Plugins.md
Outdated
Show resolved
Hide resolved
src/reference/02-DetailTopics/05-Plugins-and-Best-Practices/02-Plugins.md
Outdated
Show resolved
Hide resolved
src/reference/02-DetailTopics/05-Plugins-and-Best-Practices/02-Plugins.md
Outdated
Show resolved
Hide resolved
Notice that you won't be able to consume this plugin with sbt older than 1.9, as it can only resolve the legacy Maven style (or you need to use the trick described in [sbt-vspp](https://github.com/esbeetee/sbt-vspp)). | ||
3. If you use sbt < 1.9.x | ||
|
||
You can use https://github.com/esbeetee/sbt-vspp/ | ||
5. If you cannot use sbt 1.9.x and you cannot/don't want to use sbt-vspp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The official doc should be written based on the narrative that you should just use the latest stable version of sbt, since if anyone opening a GitHub issue would be told to do so anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I marked the first option as recommended, I agree that people should use the latest versions in general, but as we all know well it is simpler said than done. Sometimes there are things that temporarily prevent migration to more recent versions.
Is the current form ok?
Thanks for the contribution. This would be a useful information to note. |
…-Plugins.md Co-authored-by: eugene yokota <eed3si9n@gmail.com>
Thanks for the feedback, I think I addressed most of it and sorry for the long delay. |
Merged |
Relates to sbt/sbt#3410