Skip to content

EN 03 build and connect

roosit edited this page Nov 15, 2026 · 4 revisions

Русский

Build and connect the SDK

Here we go over what, in a plugin project, is responsible for connecting the SDK and for making Velitask Telemitri recognize the built JAR. In plugin-example all of this is already set up — below we explain what each fragment does, so you can reproduce it in your own project.

Connecting the SDK

The SDK is published through JitPack. In build.gradle you need the JitPack repository and the SDK dependency:

plugins {
    id 'java'
}

java {
    sourceCompatibility = JavaVersion.VERSION_21
    targetCompatibility = JavaVersion.VERSION_21
}

repositories {
    mavenCentral()
    maven { url 'https://jitpack.io' }
}

dependencies {
    compileOnly 'com.github.velitask:velitask-sdk:1.1.+'
    compileOnly 'org.json:json:20250107'
}

The SDK contains everything that only Telemitri has: the plugin contracts and the Velitask libraries whose types appear in its API. Third-party libraries that appear in the SDK API are added as a regular dependency from Maven Central: this is org.json — its JSONObject class is used by the settings save methods (toJSON, fromJSON). Use the version given above — the application uses it.

The key point is compileOnly. The SDK is needed only for compilation: at runtime it is provided by the Telemitri application itself. If you bundle the SDK inside the plugin JAR (implementation instead of compileOnly), the classes get duplicated and the plugin won't load. So the SDK and org.json are always compileOnly: at runtime the application provides them.

1.1.+ takes the latest version of the 1.1 branch. For a reproducible build, replace it with a specific version from Releases.

The JAR manifest

Telemitri finds a plugin by an attribute in the JAR manifest. Without it, the application won't recognize it as a plugin. It's configured in the jar task:

jar {
    archiveBaseName = 'my-indicator'

    manifest {
        attributes(
            'Velitask-Plugin-Class': 'com.example.myplugin.MyPlagin'
        )
    }
}

Velitask-Plugin-Class is the only attribute Telemitri reads: the fully qualified name of the plugin's entry-point class. This class must implement the IPlagin interface and have a public no-argument constructor: Telemitri creates the plugin through it on load.

The entry point and the indicator itself are your plugin's code; in plugin-example they're already written, and how they work is covered in that project's documentation (see Next steps). At this step it's enough to know: the class from Velitask-Plugin-Class implements IPlagin and returns a list of indicators.

Localizing strings

The plugin's texts (indicator and setting names) are stored in properties files in the src/main/resources/localization/ folder:

src/main/resources/localization/strings.properties      ← default (English)
src/main/resources/localization/strings_ru.properties   ← Russian

The files are UTF-8 encoded. In the indicator code a string is taken by key: localized("MyPlugin.Indicator.clock.title"). There is no need to register the files: when loading the plugin, Telemitri itself finds all localization/*.properties files in the JAR and picks the language by the file name suffix (_ru, _de, …).

The keys are shared by the whole application, so start them with a unique prefix of your plugin (plugin-example uses PluginExample.). If a key is missing, the user sees the key itself.

Building the JAR

gradle jar

The result is build/libs/<archiveBaseName>-<version>.jar. That's the finished plugin: a single file you'll hand to Telemitri in the next step.

Next: Install and run.

Clone this wiki locally