Skip to content

kordamp/jandex-gradle-plugin

Repository files navigation

jandex-gradle-plugin

Build Status Gradle Plugin Portal


Runs jandex on a Gradle project.

Usage

Option #1

buildscript {
    repositories {
        gradlePluginPortal()
        mavenCentral()
    }
    dependencies {
        classpath 'org.kordamp.gradle:jandex-gradle-plugin:2.1.0'
    }
}
apply plugin: 'org.kordamp.gradle.jandex'

Option #2

plugins {
    id 'org.kordamp.gradle.jandex' version '2.1.0'
}

This will add a jandex task to your build, which will analyze the main sourceSets by default, the generated index will be placed in ${project.tasks.processResources.destinationDir}/META-INF/jandex.idx.

ℹ️
Requires Java 11+ and Gradle 8+.

Configuration

Plugin configuration

The following properties can be specified in the jandex task configuration

Name Option Property Type Default Value

processDefaultFileSet

jandex-process-default-file-set

jandex.process.default.file.set

boolean

true

includeInJar

jandex-includein-jar

jandex.include.in.jar

boolean

true

indexName

jandex-index-name

jandex.index.name

String

jandex.idx

indexVersion

jandex-index-version

jandex.index.version

Integer

destination

File

build/jandex/jandex.idx

sources

ConfigurableFileCollection

sourceSets.main.output.classesDirs

ℹ️
The generated index file will be copied to build/resources/main/META-INF/jandex.idx during the invocation of the `processResources task if the includeInJar property is set to true.

Task properties may be defined on the command line using their option name, or their property name, such as

$ gradle jandex --jandex-index-name foo.idx
$ gradle jandex -Pjandex.index.name=foo.idx
$ gradle jandex -Djandex.index.name=foo.idx
$ set JANDEX_INDEX_NAME=foo.idx
$ gradle jandex

Jandex Version

This plugin relies on Jandex 3.1.7 to perform its job, however you may configure a different version if needed. Simply add the desired version (for the maven coordinates io.smallrye:jandex:<version>) to the jandex extension as shown next

jandex {
    version = '3.0.0'
}
⚠️
This plugin supports Jandex 3 as a minimum since version 1.0.0.

Migration

Starting with version 0.9.0 the chosen Jandex dependency must be resolved using explicit repositories, in other words, it is no longer part of the plugin’s default classpath. Failure to declare a repository from which this dependency may be resolved will result in a build failure.