Skip to content

Conversation

@Bukama
Copy link
Contributor

@Bukama Bukama commented Nov 29, 2025

This extends spotless configuration to also check groovy files. As our groovy files for IT are not in the default groovy packages include is overwritten. The delimiter is overwritten, because the empty package is not supported by spotless, even while it's a valid package.

see also: diffplug/spotless#1418

closes #284

This extends spotless configuration to also check groovy files.
As our groovy files for IT are not in the default groovy packages include is overwritten.
The delimiter is overwritten, because the empty package is not supported by spotless, even while it's a valid package.

see also: diffplug/spotless#1418

closes apache#284
@Bukama Bukama requested a review from kwin November 29, 2025 22:21
@Bukama Bukama self-assigned this Nov 29, 2025
@Bukama Bukama added the enhancement New feature or request label Nov 29, 2025
@Bukama
Copy link
Contributor Author

Bukama commented Nov 29, 2025

As you can see in the config this is just a draft to check what's possble.
As the empty package is not supported I chose to define a //nopackage string as an alternative to the default values (for the cases there are "real" groovy files).

So a file must either start with one of those (taking package from the default list here).

//nopackage
File buildLog = new File( basedir, 'build.log' )
assert buildLog.exists()

or

package whatever
File buildLog = new File( basedir, 'build.log' )
assert buildLog.exists()

To automatically adding a licence, I would (re-)create the <file>config/maven-header-plain.txt</file> file, which is mentioned in the java configuration but does not exists and therefore is not applied.

I tested with some files in the PMD-plugin to ensure the configuration (file recognition, removing semicolons, adding licence) works

edit: Hmm the regEx seems to be wrong, all groovy files are effected, even those who have a licences, but maybe that is because the ASF licences not matched the given licence in the config. Have to check.

@slawekjaranowski
Copy link
Member

config/maven-header-plain.txt is taken from https://github.com/apache/maven-shared-resources/tree/master/src/main/resources/config
as maven-shared-resources is on plugin dependencies files are available on classpath

@Bukama
Copy link
Contributor Author

Bukama commented Dec 4, 2025

config/maven-header-plain.txt is taken from https://github.com/apache/maven-shared-resources/tree/master/src/main/resources/config as maven-shared-resources is on plugin dependencies files are available on classpath

Hm it's not applied. It just stays empty when I set this fileset :(

This extends spotless configuration to also check groovy files.
As our groovy files for IT are not in the default groovy packages include is overwritten.
The delimiter is overwritten, because the empty package is not supported by spotbugs, even while it's a valid package.

see also: diffplug/spotless#1418

closes apache#284
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[MPOM-374] Autoformat *.groovy files

2 participants