diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..85e0c4c --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,70 @@ + + + + \ No newline at end of file diff --git a/binary-plugin/binary-plugin-example/README.md b/binary-plugin/binary-plugin-example/README.md index b350544..f95116e 100644 --- a/binary-plugin/binary-plugin-example/README.md +++ b/binary-plugin/binary-plugin-example/README.md @@ -1,7 +1,9 @@ # Binary Plugin Example This project serves as a template for Gradle binary plugin, it contains minimal content to compile it. It also contains -source code for following lecture [Gradle Plugin Development - Binary Plugin](https://www.udemy.com/course/gradle-development/learn/lecture/28264772#overview). +source code for following lectures: +- [Gradle Plugin Development - Binary Plugin](https://www.udemy.com/course/gradle-development/learn/lecture/28264772#overview) +- [Gradle Plugin Development - Publishing - Local Maven Repository](https://www.udemy.com/course/gradle-development/learn/lecture/29080272#overview) To successfully create a plugin you should: - Import `java-gradle-plugin` core Gradle plugin @@ -24,6 +26,19 @@ to proof that the plugin is applied. In order that plugin descriptor will be generated you have to specify plugins inside the `gradlePlugin{}` block. +## Publishing + +To be able to publish plugin to a Maven repository you have to apply `maven-publish` plugin, which will give you ability +of artifact publication. + +### Local Maven Publishing + +To publish compiled plugin to Local Maven repository you have to run task `publishToMavenLocal`. As a result this plugin will +be published to `{user-home}/.m2/repository/com/rivancic/greeting-plugin` directory. + +To be able to refenrece this plugin from withing a project you will have to define Local Maven repository inside of +`pluginManagement{}` block in `settings.gradle` file. + ## Resources diff --git a/binary-plugin/binary-plugin-example/build.gradle b/binary-plugin/binary-plugin-example/build.gradle index 41324a8..b964bff 100644 --- a/binary-plugin/binary-plugin-example/build.gradle +++ b/binary-plugin/binary-plugin-example/build.gradle @@ -1,10 +1,17 @@ /** - * Core Java Gradle Plugin. It simplifies - * compilation and publishing of Gradle binary plugins. + * java-gradle-plugin - Core Gradle Plugin, Java Gradle Plugin. + * It simplifies compilation and publishing of Gradle binary plugins. * + * maven-publish - Core Gradle Plugin, Java Gradle PluginMaven Publish + * plugin will make it possible to publish artifacts to Maven repositories. + * + * com.rivancic.greeting-plugin - if uncommented will apply itself to the Gradle build. It's meant to test the + * functionality of the plugin in project itself. */ plugins { id 'java-gradle-plugin' + id 'maven-publish' + // id 'com.rivancic.greeting-plugin' version '0.1.0' // Can be applied after its published to local or private/remote plugin repository } group 'com.rivancic' diff --git a/binary-plugin/binary-plugin-example/settings.gradle b/binary-plugin/binary-plugin-example/settings.gradle index 1062d9e..a49d15f 100644 --- a/binary-plugin/binary-plugin-example/settings.gradle +++ b/binary-plugin/binary-plugin-example/settings.gradle @@ -1,2 +1,18 @@ +/** + * By default only Gradle Plugin Portal is defined as a repository that provides Gradle plugins that can be applied + * within
plugins{}
 block.
+ *
+ * If you want to specify any additional repository you have to define them in pluginManagement block within
+ * setting.gradle file. Remember pluginManagement has to be the first statement inside settings.gradle file.
+ *
+ * In definition below both Gradle Plugin Portal and Maven Local repository will be taken into account when Gradle
+ * will search for defined plugin by its ID and version.
+ */
+pluginManagement {
+  repositories {
+    gradlePluginPortal()
+    mavenLocal()
+  }
+}
 rootProject.name = 'binary-plugin-example'