Skip to content

Commit 9b6a8d7

Browse files
committed
[#2855] Create spotless rule for package-info.java
And `module-info.java` Spotless ingores package-info.java files (see diffplug/spotless#532), but we can create a rule that applies it if the file contains a javadoc. Note that if the package-info.java doesn't have a javadoc, it will cause an exception at compile time.
1 parent bb5a14e commit 9b6a8d7

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

local-build-plugins/src/main/groovy/hr-java-library.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ spotless {
1515
trimTrailingWhitespace()
1616
endWithNewline()
1717
}
18+
format 'javaMisc', {
19+
target 'src/**/package-info.java', 'src/**/module-info.java'
20+
licenseHeaderFile rootProject.file('spotless.license.java'), '/\\*\\*'
21+
}
1822
}
1923

2024
tasks.compileJava.dependsOn(spotlessApply)

0 commit comments

Comments
 (0)