Systemy budowania

Systemy kompilacji, takie jak Gradle lub Maven, mogą zarządzać procesem kompilacji twoich projektów. Jako Niezależne narzędzie z twojego IDE możesz wykorzystać je do zarządzania zależnościami od SpongeAPI lub innych wtyczek i umożliwić innym ludziom łatwy sposób na zbudowanie twojej wtyczki ze źródła.

Informacja

SpongeAPI ** nie ** wymaga użycia systemu kompilacji do tworzenia wtyczek, jednak mocno proponujemy jego użycie. Poza krótkim wyjaśnieniem w temacie Tworzenia wtyczki bez systemu kompilacji _, następujące części przyjmą, że używasz systemu kompilacji, który może zarządzać zależnościami dla ciebie.

Generally, you can use any build system which supports Maven dependencies, which is a standard supported by the majority of build systems for Java projects. The following sections will focus on Gradle and Maven, which are the two most common choices as build systems. If you’re unsure which one to use we recommend using Gradle as it is also used for the Sponge projects and provides the best integration for Sponge plugins.

Gradle

Gradle uses Groovy-based scripts for configuring projects. A Gradle project typically consists of a build.gradle file in your project’s root directory, which tells Gradle how to build the project.

Wskazówka

Refer to the Gradle User Guide for the installation and a general introduction of concepts used in Gradle. If you’re only interested in how to use Gradle for a simple Java project, a good place to start would be the Gradle Java Quickstart.

Setup your workspace as explained in Przygotowywanie obszaru roboczego then follow Konfigurowanie Gradle.

Maven

Maven uses a XML-based configuration called Project Object Model (or POM) for configuring projects. A Maven project typically contains a pom.xml file in the project root directory which tells Maven how to build the project.

Wskazówka

Refer to the Maven Users Centre for the installation and a general introduction of concepts used in Maven. If you’re only interested in how to use Maven for a simple Java project, a good place to start would be Maven in 5 Minutes.

Setup your workspace as explained in Przygotowywanie obszaru roboczego then follow Konfigurowanie Maven.

Tworzenie pluginu bez system kompilacji

Możliwe jest tworzenie pluginów Sponge bez użycia system kompilacji, tylko przy użyciu narzędzi zawartych w twoim IDE.

Ostrzeżenie

We strongly suggest against using SpongeAPI without a build system. In the long term using a build system will simplify the development process for you and other people wanting to contribute to your project. This method of developing plugins does not receive active testing by the Sponge team.

Aby tworzyć wtyczki bez systemu kompilacji, musisz pobrać zależność SpongeAPI ręcznie ze Strony pobierania SpongeAPI. Do rozwoju bez systemu kompilacji dostarczamy artefakt „cieniowany”, łączący wszystkie zależności, które normalnie byłyby automatycznie pobierane przez system kompilacji.

After you have downloaded the shaded artifact and have added it to a project in your IDE, you can start developing your plugin. Continue at Identyfikatory Pluginów for choosing an identifier for your project, then continue at Główna Klasa Pluginu.