Skip to content
This repository has been archived by the owner on Jun 13, 2023. It is now read-only.

Commit

Permalink
sort files from scanner for reproducible index output
Browse files Browse the repository at this point in the history
Signed-off-by: Hervé Boutemy <[email protected]>
  • Loading branch information
hboutemy committed Feb 20, 2021
1 parent 4e24990 commit f9d792e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>org.jboss</groupId>
Expand All @@ -118,8 +124,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/org/jboss/jandex/maven/JandexGoal.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

import org.apache.maven.plugin.Mojo;
Expand Down Expand Up @@ -165,6 +166,15 @@ public void execute()

final DirectoryScanner scanner = new DirectoryScanner();
scanner.setBasedir( dir );
// order files to get reproducible result
scanner.setFilenameComparator( new Comparator<String>()
{
@Override
public int compare( String s1, String s2 )
{
return s1.compareTo( s2 );
}
} );

if ( fileset.isUseDefaultExcludes() )
{
Expand Down

0 comments on commit f9d792e

Please sign in to comment.