Skip to content

Commit 732558c

Browse files
committed
Exclude generated-test-sources
Closes gh-188
1 parent 8b08bf2 commit 732558c

File tree

1 file changed

+5
-2
lines changed
  • spring-javaformat-maven/spring-javaformat-maven-plugin/src/main/java/io/spring/format/maven

1 file changed

+5
-2
lines changed

spring-javaformat-maven/spring-javaformat-maven-plugin/src/main/java/io/spring/format/maven/FormatMojo.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ public abstract class FormatMojo extends AbstractMojo {
4343

4444
private static final String[] DEFAULT_INCLUDES = new String[] { "**/*.java" };
4545

46-
private static final String GENERATED_SOURCE = File.separator + "generated-sources" + File.separator;
46+
private static final String GENERATED_SOURCES = File.separator + "generated-sources" + File.separator;
47+
48+
private static final String GENERATED_TEST_SOURCES = File.separator + "generated-test-sources" + File.separator;
4749

4850
/**
4951
* The Maven Project Object.
@@ -121,7 +123,8 @@ private boolean isGeneratedSource(File file) {
121123
try {
122124
String path = file.getCanonicalPath() + File.separator;
123125
String projectPath = this.project.getBasedir().getCanonicalPath();
124-
return path.startsWith(projectPath) && path.contains(GENERATED_SOURCE);
126+
return path.startsWith(projectPath)
127+
&& (path.contains(GENERATED_SOURCES) || path.contains(GENERATED_TEST_SOURCES));
125128
}
126129
catch (IOException ex) {
127130
return false;

0 commit comments

Comments
 (0)