Gradle 설치하기

SpongeGradle 사용하기

SpongeGradle은 Sponge 플러그인을 설정하기 위해 필요한 Gradle 설정을 최소화 해주는 Gradle 플러그인입니다. 부가적으로, 이 플러그인은 당신의 빌드 스크립트에 정의된 그룹, 프로젝트 이름, 버전, 프로젝트 설명을 빌드된 플러그인에 자동으로 적용해주는 등 플러그인 메타데이터의 연계 기능을 제공합니다. 따라서 당신은 플러그인의 버전을 빌드 스크립트에서만 관리하면 됩니다.

Most problems are caused by attempting to use an outdated Gradle version. We recommend using the latest Gradle version together with SpongeGradle. The Gradle section of the build systems page explains how to setup Gradle on your computer.

아래 예제는 거의 모든 플러그인에서 사용될 수 있는 빌드 스크립트입니다. group 값으로 당신이 전에 선택한 group ID를 대입해야 동작합니다.

plugins {
    id 'java-library'
    id("org.spongepowered.plugin") version '0.11.3'
}

// This may not be required, but has solved issues in the past
compileJava.options.encoding = 'UTF-8'

// TODO: Change the following to match your information
group = 'com.example'
version = '1.0.0-SNAPSHOT'
description = 'Here lies an example plugin definition'

repositories {
    mavenCentral()
}

sponge {
    apiVersion("8.1.0")
    licence("MIT")
    loader {
        name(PluginLoaders.JAVA_PLAIN)
        version("1.0")
    }
    plugin("**plugin Id**") {
        displayName("**Plugin Name**")
        entrypoint("**Plugin Entrypoint**")
        description("**Plugin Description**")
        dependency("spongeapi") {
            loadOrder(PluginDependency.LoadOrder.AFTER)
            optional(false)
        }
    }
}

이것으로 당신은 수동으로 해야 할 설정들을 자동으로 맡길 수 있습니다:

  • 기본적인 Gradle의 Java 설정

  • Sponge의 Maven (그리고 Maven Central) 저장소 추가

  • 플러그인 설정에서 프로젝트 이름을 소문자 **플러그인 ID**로 지정

  • Automatically includes the project name, description and version in 플러그인 메타데이터.

SpongeGradle 없이 빌드하기

경고

SpongeGradle은 Sponge 플러그인 개발에 부가적인 연계 기능을 제공하는 Gradle 플러그인입니다. 사용하는 것을 권장드립니다.

Generally, everything necessary to compile a Sponge plugin using Gradle can be done by simply adding the SpongeAPI dependency to your project:

repositories {
    mavenCentral()
    maven {
        name = 'sponge-repo'
        url = 'https://repo.spongepowered.org/repository/maven-public/'
    }
}

dependencies {
    compile 'org.spongepowered:spongeapi:8.0.0'
}