From d696bc9251fd0c8cf4493006bbe2ee587d040191 Mon Sep 17 00:00:00 2001 From: Kasper Kondzielski Date: Wed, 1 Nov 2023 10:38:58 +0100 Subject: [PATCH 1/3] Add note about sbtPluginPublishLegacyMavenStyle Relates to https://github.com/sbt/sbt/issues/3410 --- .../02-Plugins.md | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/reference/02-DetailTopics/05-Plugins-and-Best-Practices/02-Plugins.md b/src/reference/02-DetailTopics/05-Plugins-and-Best-Practices/02-Plugins.md index d1caa8d3..c92f099a 100644 --- a/src/reference/02-DetailTopics/05-Plugins-and-Best-Practices/02-Plugins.md +++ b/src/reference/02-DetailTopics/05-Plugins-and-Best-Practices/02-Plugins.md @@ -508,6 +508,29 @@ libraryDependencies ++= Seq.empty ``` +### Publishing a plugin + +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. + +If your artifacts repository expect artifacts to be compliant with maven scheme and rejects artifacts that does no adhere to it you can: +1. If you and consumers of your plugin use sbt 1.9.x + + Since sbt 1.9, it tries to publish any plugin with the new and legacy Maven style (for backward compatibility). The legacy Maven style is not fully compatible with Maven scheme. + You need to disable it with: + `sbtPluginPublishLegacyMavenStyle := false` + 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 should be an option like `Suppress POM Consistency Checks` in your artifactory settings that will allow you to submit artifacts even if they don't fully follow maven scheme. + +You can find more details about this in the [following issue](https://github.com/sbt/sbt/issues/3410). + ### Best Practices If you're a plugin writer, please consult the [Plugins Best Practices][Plugins-Best-Practices] From 88d6638da58b49e8746477d60b191948b8093eae Mon Sep 17 00:00:00 2001 From: Kasper Kondzielski Date: Sun, 7 Jan 2024 11:41:55 +0100 Subject: [PATCH 2/3] Update src/reference/02-DetailTopics/05-Plugins-and-Best-Practices/02-Plugins.md Co-authored-by: eugene yokota --- .../02-DetailTopics/05-Plugins-and-Best-Practices/02-Plugins.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/reference/02-DetailTopics/05-Plugins-and-Best-Practices/02-Plugins.md b/src/reference/02-DetailTopics/05-Plugins-and-Best-Practices/02-Plugins.md index c92f099a..ea0fe700 100644 --- a/src/reference/02-DetailTopics/05-Plugins-and-Best-Practices/02-Plugins.md +++ b/src/reference/02-DetailTopics/05-Plugins-and-Best-Practices/02-Plugins.md @@ -510,7 +510,7 @@ libraryDependencies ++= ### Publishing a plugin -Sbt plugins can be published as any other projects. +Plugins can be published like any other projects. When publishing your plugin to a Maven-layout repository, use sbt 1.9.x or above. 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. From 5e30d3c325bffc23c278692af2cf565f738919a5 Mon Sep 17 00:00:00 2001 From: ghostbuster91 Date: Sun, 7 Jan 2024 11:57:53 +0100 Subject: [PATCH 3/3] Unify naming and drop not-important details --- .../05-Plugins-and-Best-Practices/02-Plugins.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/reference/02-DetailTopics/05-Plugins-and-Best-Practices/02-Plugins.md b/src/reference/02-DetailTopics/05-Plugins-and-Best-Practices/02-Plugins.md index ea0fe700..f74cbd14 100644 --- a/src/reference/02-DetailTopics/05-Plugins-and-Best-Practices/02-Plugins.md +++ b/src/reference/02-DetailTopics/05-Plugins-and-Best-Practices/02-Plugins.md @@ -512,13 +512,12 @@ libraryDependencies ++= Plugins can be published like any other projects. When publishing your plugin to a Maven-layout repository, use sbt 1.9.x or above. -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. +However, there is one caveat if you attempt to publish your plugin to a repository that follows the Maven layout. -If your artifacts repository expect artifacts to be compliant with maven scheme and rejects artifacts that does no adhere to it you can: -1. If you and consumers of your plugin use sbt 1.9.x +If your artifacts repository expect artifacts to be compliant with Maven layout and rejects artifacts that do not adhere to it you can: +1. (recommended) If you and consumers of your plugin use sbt 1.9.x or above - Since sbt 1.9, it tries to publish any plugin with the new and legacy Maven style (for backward compatibility). The legacy Maven style is not fully compatible with Maven scheme. + Since sbt 1.9, it tries to publish any plugin with both the new and legacy Maven style (for backward compatibility). The legacy Maven style is not fully compatible with Maven layout. You need to disable it with: `sbtPluginPublishLegacyMavenStyle := false` 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)). @@ -527,7 +526,7 @@ If your artifacts repository expect artifacts to be compliant with maven scheme 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 should be an option like `Suppress POM Consistency Checks` in your artifactory settings that will allow you to submit artifacts even if they don't fully follow maven scheme. + There should be an option like `Suppress POM Consistency Checks` in your artifactory settings that will allow you to submit artifacts even if they don't fully follow Maven layout. You can find more details about this in the [following issue](https://github.com/sbt/sbt/issues/3410).