Analyse
SDKInstallation

SDK

Installation

Add the SDK to your plugin project with Maven or Gradle.

Adding the Analyse API to your plugin project takes two snippets in your build file.

The API is a small library that ships on our public Maven repository. Your plugin includes it as a compileOnly dependency and the Analyse plugin provides the actual implementation at runtime.

Maven repository

Add our repo once. This is where the API is published.

<repositories>
<repository>
<id>analyse</id>
<url>https://maven.analyse.net/maven-releases</url>
</repository>
</repositories>

Dependency

Add the API itself as compileOnly. Replace LATEST_VERSION with the latest release (check downloads).

<dependency>
<groupId>net.analyse</groupId>
<artifactId>analyse-api</artifactId>
<version>LATEST_VERSION</version>
<scope>provided</scope>
</dependency>

Don't shade it

The API is compileOnly on purpose. The Analyse plugin exposes the implementation at runtime. If you shade the API into your jar, you'll get NoSuchMethodErrors and other mysterious crashes.

Declare Analyse as a soft dependency

In your plugin.yml, add Analyse as a soft dependency so your plugin still loads when Analyse isn't installed.

yaml
name: YourPlugin
version: 1.0.0
main: com.example.YourPlugin
softdepend: [Analyse]

This way, your code can use the Analyse API when it's there and gracefully no-op when it isn't (see Overview for the isAvailable() pattern).

Verify the install

Reload or restart your server. In your own plugin's onEnable, add:

java
if (net.analyse.api.Analyse.isAvailable()) {
getLogger().info("Analyse API is available.");
} else {
getLogger().warning("Analyse API not found. Skipping analytics.");
}

If you see the green log line, you're done.

Next