Skip to content

Commit

Permalink
fix(gradle): publish build artifacts to maven
Browse files Browse the repository at this point in the history
  • Loading branch information
Silthus committed May 5, 2020
1 parent 09dfc35 commit a997f81
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 53 deletions.
1 change: 0 additions & 1 deletion .github/workflows/gradle.yml
Expand Up @@ -33,7 +33,6 @@ jobs:
- name: Upload build artifacts
uses: actions/upload-artifact@v1
with:
name: Plugin
path: build/libs

- name: Upload Test Report
Expand Down
27 changes: 14 additions & 13 deletions 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.
31 changes: 0 additions & 31 deletions build.gradle
Expand Up @@ -3,18 +3,13 @@ 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 {
id 'com.github.johnrengelman.shadow' version '5.1.0'
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'
}

Expand Down Expand Up @@ -44,10 +39,6 @@ spigot {
// depends = ['']
}

allprojects {
apply plugin: "com.jfrog.artifactory"
}

compileJava {
options.encoding = 'UTF-8'
options.compilerArgs += ["-parameters"]
Expand Down Expand Up @@ -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()
}
Expand Down
8 changes: 4 additions & 4 deletions 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 =
28 changes: 24 additions & 4 deletions gradle/publish.gradle
Expand Up @@ -12,6 +12,11 @@ def getHash() {
return process.text.trim()
}

java {
withJavadocJar()
withSourcesJar()
}

jar {
manifest {
attributes (
Expand All @@ -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)
}
}

0 comments on commit a997f81

Please sign in to comment.