The plugin allows verifying if class files are parseable with jandex.
Note: if you are building a library, then you might want to refrain from including index.idx
file
into the default jar file since it might cause issues when consumers chose to shade dependencies.
The relevant tracking issues is smallrye/jandex#100
plugins {
id("com.github.vlsi.jandex")
}
// or jandex { ... }
project.configure<com.github.vlsi.jandex.JandexExtension> {
skipIndexFileGeneration()
}
This parses all the class files with Jandex, and it skips producing the index file.
That enables incremental processing, so the task processes only the modified .class
files.
// or jandex { ... }
project.configure<com.github.vlsi.jandex.JandexExtension> {
includeIndexInJar(false)
}
By default, the plugin includes the index to the jar, however, you could skip that.
// or jandex { ... }
project.configure<com.github.vlsi.jandex.JandexExtension> {
skipDefaultProcessing()
}
The plugin adds jandexClasspath
configuration that resolves org.jboss.jandex.Indexer
class.
By default, it resolves org.jboss:jandex:2.0.3.Final
The plugin adds jandex
extension (com.github.vlsi.jandex.JandexExtension
).
Property name | Type | Default value | Comment |
---|---|---|---|
toolVersion | Property<String> |
2.0.3.Final | The version of org.jboss:jandex to be used |
jandexBuildAction | Property<JandexBuildAction> |
BUILD_AND_INCLUDE |
Configures the index file should be produced and placed to the jar. Possible values: NONE , VERIFY_ONLY , BUILD , BUILD_AND_INCLUDE |
Methods:
skipDefaultProcessing()
. Skips defaultjandexMain
,jandexTest
, and so on tasks. It is helpful if you want to index a customized set of files.skipIndexFileGeneration()
. Tells the plugin that the resultingjandex
index file is not needed, so it is not generated. This configuration allows the plugin to use incremental processing.includeIndexInJar(include: Boolean = true)
. Configures if
com.github.vlsi.jandex.JandexTask
task builds the index file.
The tasks are created for each sourceSet
(e.g. jandexMain
, jandexTest
),
and it adds a lifecycle task jandex
to execute all of them at once.
The tasks are bound to check
task.
Property name | Type | Default value | Comment |
---|---|---|---|
classpath | input, ConfigurableFileCollection |
jandexClasspath |
The classpath to be used for org.jboss.jandex.Indexer resolution |
inputFiles | input, ConfigurableFileCollection |
All class files of a given sourceSet |
The set of input files to verify and index |
verifyOnly | input, Property<Boolean> |
false |
Skips writing the index file (generates empty file), so jandex can be used as an extra bytecode verifier |
indexFile | output, RegularFileProperty |
build/jandex/$taskName/jandex.idx |
Output file with the resulting index. If the value is not set, then the task only parses the classes, and it does not write the index |
com.github.vlsi.jandex.JandexProcessResources
task copies the generated index to the resources
directory.
Note: if verifyOnly
of the corresponding JandexTask
task is true
, then JandexProcessResources
is a no-op.
If verifyOnly
is false
(which is the default), then the task copies the index
to the resource directory, and it would be included into the jar.
Property name | Type | Default value | Comment |
---|---|---|---|
indexDestinationPath | input, Property<String> |
META-INF |
The parent directory for the index file. The name of the index file is reused from JandexTask.indexFile |
v1.73
- Fixed "Task with name 'check' not found" when the plugin is applied with
plugins { ... }
v1.72
- Add
maxErrors
option to show several errors rather than stop on the first one
v1.71 - Initial version