Skip to content

Commit

Permalink
Configure persistent index format version in the Maven plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
iam-afk committed Aug 11, 2023
1 parent ad1785b commit 12563b0
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ public class JandexGoal extends AbstractMojo {
@Parameter(defaultValue = "jandex.idx")
private String indexName;

/**
* Persistent index format version to write. Defaults to max supported version.
*/
@Parameter
private Integer indexVersion;

/**
* Skip execution if set.
*/
Expand Down Expand Up @@ -169,7 +175,11 @@ public void execute() throws MojoExecutionException {
Files.createDirectories(indexDir.toPath());
try (OutputStream out = new CachingOutputStream(indexFile)) {
IndexWriter writer = new IndexWriter(out);
writer.write(index);
if (indexVersion != null) {
writer.write(index, indexVersion);
} else {
writer.write(index);
}
}
} catch (IOException e) {
throw new MojoExecutionException("Could not save index " + indexFile, e);
Expand Down

0 comments on commit 12563b0

Please sign in to comment.