diff --git a/maven-plugin/src/main/java/org/jboss/jandex/maven/JandexJarGoal.java b/maven-plugin/src/main/java/org/jboss/jandex/maven/JandexJarGoal.java index 5021e4a0..23f26aac 100644 --- a/maven-plugin/src/main/java/org/jboss/jandex/maven/JandexJarGoal.java +++ b/maven-plugin/src/main/java/org/jboss/jandex/maven/JandexJarGoal.java @@ -39,6 +39,12 @@ public class JandexJarGoal extends AbstractMojo { @Parameter(defaultValue = "META-INF/jandex.idx") private String indexName; + /** + * Persistent index format version to write. Defaults to max supported version. + */ + @Parameter + private Integer indexVersion; + /** * Names or glob patterns of files in the JAR that should be indexed. */ @@ -103,7 +109,12 @@ public void execute() throws MojoExecutionException { } out.putNextEntry(new ZipEntry(indexName)); - new IndexWriter(out).write(index); + IndexWriter writer = new IndexWriter(out); + if (indexVersion != null) { + writer.write(index, indexVersion); + } else { + writer.write(index); + } } catch (IOException e) { try { Files.deleteIfExists(tmp);