Skip to content

Installation

srnyx edited this page Jun 25, 2023 · 5 revisions

The API is available on Jitpack, where you can see all of the available versions.

Table of contents

Gradle

Gradle is the recommended build tool to use for Annoying API. There are multiple methods to install Annoying API with Gradle:

Galaxy

Galaxy is the most recommended and simplest way to install Annoying API, it uses a custom plugin made by srnyx (currently only supports Kotlin). Please see the Gradle Galaxy wiki on how to setup Annoying API using Gradle Galaxy.

Kotlin

// Required plugins
plugins {
    java
    id("com.github.johnrengelman.shadow") version "8.1.1" // https://github.com/johnrengelman/shadow/releases/latest
}
// Jitpack repository
repositories {
    maven("https://jitpack.io")
}
// Annoying API dependency declaration
dependencies {
    implementation("xyz.srnyx", "annoying-api", "VERSION")
}
// It's recommended to relocate the API to avoid conflicts
tasks { 
    shadowJar { 
        relocate("xyz.srnyx.annoyingapi", "YOUR.PACKAGE.annoyingapi")
    }
}

Groovy

// Required plugins
plugins {
  id 'java'
  id 'com.github.johnrengelman.shadow' version '8.1.1' // https://github.com/johnrengelman/shadow/releases/latest
}
// Jitpack repository
repositories {
    maven { url = 'https://jitpack.io' }
}
// AnnoyingAPI dependency declaration
dependencies {
    implementation 'xyz.srnyx:annoying-api:VERSION'
}
// It's recommended to relocate the API to avoid conflicts
shadowJar {
    relocate 'xyz.srnyx.annoyingapi', 'YOUR.PACKAGE.annoyingapi'
}

Maven

I highly discourage using Maven as the formatting is an abomination, please see the other highly recommended options above instead!

  • Jitpack repository
     <repositories>
          <repository>
              <id>jitpack</id>
              <url>https://jitpack.io</url>
          </repository>
      </repositories>
  • Annoying API dependency declaration
      <dependencies>
          <dependency>
              <groupId>xyz.srnyx</groupId>
              <artifactId>annoying-api</artifactId>
              <version>VERSION</version>
          </dependency>
      </dependencies>
  • Shade plugin
    <build>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-shade-plugin</artifactId>
          <version>3.4.1</version>
          <executions>
            <execution>
              <phase>package</phase>
              <goals>
                <goal>shade</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
          <!-- Exclude resources to avoid conflicts -->
            <filters>
              <filter>
                <artifact>xyz.srnyx:*</artifact>
                <excludes>
                  <exclude>META-INF/*.MF</exclude>
                  <exclude>plugin.yml</exclude>
                </excludes>
              </filter>
            </filters>
            <relocations>
            <!-- It's recommended to relocate the API to avoid conflicts -->
              <relocation>
                  <pattern>xyz.srnyx.annoyingapi</pattern>
                  <shadedPattern>YOUR.PACKAGE.annoyingapi</shadedPattern>
              </relocation>
            </relocations>
          </configuration>
        </plugin>
      </plugins>
    </build>