From a997f8196d7e58f2dbeea46a94f0584ef1be6593 Mon Sep 17 00:00:00 2001 From: Michael Reichenbach Date: Tue, 5 May 2020 15:17:38 +0200 Subject: [PATCH] fix(gradle): publish build artifacts to maven --- .github/workflows/gradle.yml | 1 - Readme.md | 27 ++++++++++++++------------- build.gradle | 31 ------------------------------- gradle.properties | 8 ++++---- gradle/publish.gradle | 28 ++++++++++++++++++++++++---- 5 files changed, 42 insertions(+), 53 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 93a1c0d..4a42f97 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -33,7 +33,6 @@ jobs: - name: Upload build artifacts uses: actions/upload-artifact@v1 with: - name: Plugin path: build/libs - name: Upload Test Report diff --git a/Readme.md b/Readme.md index 8663ed0..c5dc755 100644 --- a/Readme.md +++ b/Readme.md @@ -1,41 +1,42 @@ +[![Build Status](https://github.com/mcSilthus/spigot-plugin-template/workflows/Build/badge.svg)](https://github.com/mcSilthus/spigot-plugin-template/actions?query=workflow%3ABuild) +[![GitHub release (latest SemVer including pre-releases)](https://img.shields.io/github/v/release/mcSilthus/spigot-plugin-template?include_prereleases&label=release)](https://github.com/mcSilthus/spigot-plugin-template) +[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) +[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) + # Workspace Setup -You can use this template to develop your own Spigot plugins with [Gradle](https://gradle.org/). +You can use this template to develop your own Spigot plugins with [Gradle](https://gradle.org/). ## Supported Versions | Version | Support | | ------- | :-----: | -| 1.8.8 | ✔️ | -| 1.12.2 | ✔️ | -| 1.13.2 | ✔️ | -| 1.14.4 | ✔️ | -| 1.15.2 | ✔️ | - +| 1.8.8 | ✔️ | +| 1.12.2 | ✔️ | +| 1.13.2 | ✔️ | +| 1.14.4 | ✔️ | +| 1.15.2 | ✔️ | ## Setup Template -> **Note** This setup is actual only for IntelliJ +> **Note** This setup is actual only for IntelliJ - Create a new Github project using this template - Clone this repository and open it in IntelliJ - Import the project with gradle -- Go into the gradle.properties file and update the variables. +- Go into the gradle.properties file and update the variables. - Then execute the **setupServer** run configuration and the template will download the server jar file. Then you can start coding :) - ## Deploy Task -You can export your plugin to the plugins directory from your working directory with the Gradle **deploy task**. The task will **build and copy** your plugin **automatically**. - +You can export your plugin to the plugins directory from your working directory with the Gradle **deploy task**. The task will **build and copy** your plugin **automatically**. ## Debugging the Server You can use and debug the installed test server by running the Server run configuration. Every time you start the server, the plugin will be deployed. You can disable it, when you edit the Server run configuration. - ## Important info By using this template and starting the server, you agree to the Minecraft EULA automatically, because in this template is the eula file, because then you dont have to agree manually. diff --git a/build.gradle b/build.gradle index d09a09a..a82bdb4 100644 --- a/build.gradle +++ b/build.gradle @@ -3,10 +3,6 @@ buildscript { jcenter() mavenCentral() } - dependencies { - //Check for the latest version here: http://plugins.gradle.org/plugin/com.jfrog.artifactory - classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4+" - } } plugins { @@ -14,7 +10,6 @@ plugins { id 'kr.entree.spigradle' version '1.2.1' id 'java' id 'jacoco' - id "com.jfrog.artifactory" version '4.15.2' id 'com.diffplug.gradle.spotless' version '3.28.1' } @@ -44,10 +39,6 @@ spigot { // depends = [''] } -allprojects { - apply plugin: "com.jfrog.artifactory" -} - compileJava { options.encoding = 'UTF-8' options.compilerArgs += ["-parameters"] @@ -94,28 +85,6 @@ dependencies { testImplementation 'com.github.seeseemelk:MockBukkit-v1.15:0.3.0-SNAPSHOT' } -artifactory { - contextUrl = "${artifactory_contextUrl}" //The base Artifactory URL if not overridden by the publisher/resolver - publish { - repository { - repoKey = 'libs-snapshot-local' - username = "${artifactory_user}" - password = "${artifactory_password}" - maven = true - - } - } - resolve { - repository { - repoKey = 'libs-snapshot' - username = "${artifactory_user}" - password = "${artifactory_password}" - maven = true - - } - } -} - test { useJUnit() } diff --git a/gradle.properties b/gradle.properties index 62365b9..7b335b6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,9 +1,9 @@ -version = 1.0.0 +group = net.silthus +packageName = spigot-template +version = 1.1.0-SNAPSHOT pluginName = PluginName author = Silthus -group = com.silthus apiVersion = 1.15 mcVersion = 1.15.2 -packageName = net.silthus.template -pluginFolder = artifactory_contextUrl=https://artifactory.silthus.net/artifactory +pluginFolder = \ No newline at end of file diff --git a/gradle/publish.gradle b/gradle/publish.gradle index 7686cd8..38bb52b 100644 --- a/gradle/publish.gradle +++ b/gradle/publish.gradle @@ -12,6 +12,11 @@ def getHash() { return process.text.trim() } +java { + withJavadocJar() + withSourcesJar() +} + jar { manifest { attributes ( @@ -25,16 +30,31 @@ jar { publishing { publications { - maven(MavenPublication) { - groupId 'net.silthus' + mavenJava(MavenPublication) { + groupId = group + artifactId = packageName from components.java } } repositories { maven { def releasesRepoUrl = "${artifactory_contextUrl}/libs-release-local" - def snapshotsRepoUrl = "$buildDir/repos/libs-snapshot-local" - url = project.hasProperty('release') ? releasesRepoUrl : snapshotsRepoUrl + def snapshotsRepoUrl = "${artifactory_contextUrl}/libs-snapshot-local" + if (version.endsWith('SNAPSHOT')) { + url = snapshotsRepoUrl + } else { + url = releasesRepoUrl + } + credentials { + username = "${artifactory_user}" + password = "${artifactory_password}" + } } } } + +javadoc { + if(JavaVersion.current().isJava9Compatible()) { + options.addBooleanOption('html5', true) + } +} \ No newline at end of file