Skip to content

Commit

Permalink
Publish plugins
Browse files Browse the repository at this point in the history
Publishing is only an additional configuration of the plugins build.
Hence it is the same setup for all approaches.
You can publish:
- To your own repository. Then you only need the
  id("maven-publish") plugin and configure your repository
- To the Gradle Plugin Portal. Then you additionally need the
  id("com.gradle.plugin-publish") plugin and configure additional
  metadata that will be shown on the plugin portal website.
  • Loading branch information
jjohannes committed Jul 19, 2022
1 parent 39baa4d commit 3293cdd
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 0 deletions.
11 changes: 11 additions & 0 deletions clojure/gradle-build-logic/java-plugins/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
plugins {
id("java-gradle-plugin")
id("dev.clojurephant.clojure") version "0.6.0"
id("maven-publish") // if you never publish the plugin, you may remove this (but it also does not hurt)
id("com.gradle.plugin-publish") version "1.0.0" // if you do not publish to the Gradle Plugin Portal, you may remove this (but it also does not hurt)
}

// clojurephant plugin specifics
Expand Down Expand Up @@ -30,3 +32,12 @@ dependencies {
because("Provides the 'com.diffplug.spotless' formatting plugin")
}
}

// if you do not publish, the following is optional
version = "1.0"
publishing.repositories.maven("../../../_gradle-plugins-repository") // own repository to publish to (if needed) - run ':publish' task
pluginBundle { // Plugin Portal Metadata (only needed if you publish to Gradle Plugin Portal) - run ':publishPlugins' task
website = "https://github.com/jjohannes/gradle-plugins-howto"
vcsUrl = "https://github.com/jjohannes/gradle-plugins-howto.git"
tags = listOf("example")
}
11 changes: 11 additions & 0 deletions groovy-dsl/gradle-build-logic/java-plugins/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
plugins {
id("groovy-gradle-plugin")
id("maven-publish") // if you never publish the plugin, you may remove this (but it also does not hurt)
id("com.gradle.plugin-publish") version "1.0.0" // if you do not publish to the Gradle Plugin Portal, you may remove this (but it also does not hurt)
}

group = "software.onepiece.gradle.pluginshowto"
Expand All @@ -11,3 +13,12 @@ dependencies {
because("Provides the 'com.diffplug.spotless' formatting plugin")
}
}

// if you do not publish, the following is optional
version = "1.0"
publishing.repositories.maven("../../../_gradle-plugins-repository") // own repository to publish to (if needed) - run ':publish' task
pluginBundle { // Plugin Portal Metadata (only needed if you publish to Gradle Plugin Portal) - run ':publishPlugins' task
website = "https://github.com/jjohannes/gradle-plugins-howto"
vcsUrl = "https://github.com/jjohannes/gradle-plugins-howto.git"
tags = listOf("example")
}
11 changes: 11 additions & 0 deletions groovy/gradle-build-logic/java-plugins/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
plugins {
id("java-gradle-plugin")
id("groovy")
id("maven-publish") // if you never publish the plugin, you may remove this (but it also does not hurt)
id("com.gradle.plugin-publish") version "1.0.0" // if you do not publish to the Gradle Plugin Portal, you may remove this (but it also does not hurt)
}

group = "software.onepiece.gradle.pluginshowto"
Expand All @@ -26,3 +28,12 @@ dependencies {
because("Provides the 'com.diffplug.spotless' formatting plugin")
}
}

// if you do not publish, the following is optional
version = "1.0"
publishing.repositories.maven("../../../_gradle-plugins-repository") // own repository to publish to (if needed) - run ':publish' task
pluginBundle { // Plugin Portal Metadata (only needed if you publish to Gradle Plugin Portal) - run ':publishPlugins' task
website = "https://github.com/jjohannes/gradle-plugins-howto"
vcsUrl = "https://github.com/jjohannes/gradle-plugins-howto.git"
tags = listOf("example")
}
11 changes: 11 additions & 0 deletions java/gradle-build-logic/java-plugins/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
plugins {
id("java-gradle-plugin")
id("maven-publish") // if you never publish the plugin, you may remove this (but it also does not hurt)
id("com.gradle.plugin-publish") version "1.0.0" // if you do not publish to the Gradle Plugin Portal, you may remove this (but it also does not hurt)
}

group = "software.onepiece.gradle.pluginshowto"
Expand All @@ -25,3 +27,12 @@ dependencies {
because("Provides the 'com.diffplug.spotless' formatting plugin")
}
}

// if you do not publish, the following is optional
version = "1.0"
publishing.repositories.maven("../../../_gradle-plugins-repository") // own repository to publish to (if needed) - run ':publish' task
pluginBundle { // Plugin Portal Metadata (only needed if you publish to Gradle Plugin Portal) - run ':publishPlugins' task
website = "https://github.com/jjohannes/gradle-plugins-howto"
vcsUrl = "https://github.com/jjohannes/gradle-plugins-howto.git"
tags = listOf("example")
}
11 changes: 11 additions & 0 deletions kotlin-dsl/gradle-build-logic/java-plugins/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
plugins {
`kotlin-dsl`
id("maven-publish") // if you never publish the plugin, you may remove this (but it also does not hurt)
id("com.gradle.plugin-publish") version "1.0.0" // if you do not publish to the Gradle Plugin Portal, you may remove this (but it also does not hurt)
}

group = "software.onepiece.gradle.pluginshowto"
Expand All @@ -11,3 +13,12 @@ dependencies {
because("Provides the 'com.diffplug.spotless' formatting plugin")
}
}

// if you do not publish, the following is optional
version = "1.0"
publishing.repositories.maven("../../../_gradle-plugins-repository") // own repository to publish to (if needed) - run ':publish' task
pluginBundle { // Plugin Portal Metadata (only needed if you publish to Gradle Plugin Portal) - run ':publishPlugins' task
website = "https://github.com/jjohannes/gradle-plugins-howto"
vcsUrl = "https://github.com/jjohannes/gradle-plugins-howto.git"
tags = listOf("example")
}
11 changes: 11 additions & 0 deletions kotlin/gradle-build-logic/java-plugins/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
plugins {
id("java-gradle-plugin")
id("org.jetbrains.kotlin.jvm") version "1.5.21" // caveat: version should match version embedded in Gradle version you are using
id("maven-publish") // if you never publish the plugin, you may remove this (but it also does not hurt)
id("com.gradle.plugin-publish") version "1.0.0" // if you do not publish to the Gradle Plugin Portal, you may remove this (but it also does not hurt)
}

group = "software.onepiece.gradle.pluginshowto"
Expand All @@ -26,3 +28,12 @@ dependencies {
because("Provides the 'com.diffplug.spotless' formatting plugin")
}
}

// if you do not publish, the following is optional
version = "1.0"
publishing.repositories.maven("../../../_gradle-plugins-repository") // own repository to publish to (if needed) - run ':publish' task
pluginBundle { // Plugin Portal Metadata (only needed if you publish to Gradle Plugin Portal) - run ':publishPlugins' task
website = "https://github.com/jjohannes/gradle-plugins-howto"
vcsUrl = "https://github.com/jjohannes/gradle-plugins-howto.git"
tags = listOf("example")
}
11 changes: 11 additions & 0 deletions scala/gradle-build-logic/java-plugins/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
plugins {
id("java-gradle-plugin")
id("scala")
id("maven-publish") // if you never publish the plugin, you may remove this (but it also does not hurt)
id("com.gradle.plugin-publish") version "1.0.0" // if you do not publish to the Gradle Plugin Portal, you may remove this (but it also does not hurt)
}

dependencies { implementation("org.scala-lang:scala-library:2.13.6") }
Expand Down Expand Up @@ -28,3 +30,12 @@ dependencies {
because("Provides the 'com.diffplug.spotless' formatting plugin")
}
}

// if you do not publish, the following is optional
version = "1.0"
publishing.repositories.maven("../../../_gradle-plugins-repository") // own repository to publish to (if needed) - run ':publish' task
pluginBundle { // Plugin Portal Metadata (only needed if you publish to Gradle Plugin Portal) - run ':publishPlugins' task
website = "https://github.com/jjohannes/gradle-plugins-howto"
vcsUrl = "https://github.com/jjohannes/gradle-plugins-howto.git"
tags = listOf("example")
}

0 comments on commit 3293cdd

Please sign in to comment.