Hi,

yes, code formatting destroying syntax is another problem I ran into recently. In that case it was not destroying the syntax, the code did compile, but had strange characters in the test assertions which made the tests fail. I first thought my changes broke something.

A build changing the source code is something you want to avoid, it basically is against the idea of reproducible builds.

The best is to do no automated formatting and do the check in the verify phase.

We can then discuss adding pre commit hooks that prevent from pushing code that is not formatted - which I think in the end is the better option anyway.

Regards
Carsten

On 4/28/2026 10:15 AM, Konrad Windszus wrote:
Hi Carsten,
My point for doing it early is that otherwise you might miss to detect 
formatting which destroys syntax (shouldn’t happen, but sometimes does)
But I also see the point for doing it later.

Just some references:
- This is how Apache Maven is doing it: 
https://github.com/apache/maven-parent/blob/ae7bfb185ddf730cb183968f10c5524a33edc14d/pom.xml#L1265
- Apache Avro: 
https://github.com/apache/avro/blob/8026c8ffe4ef67ab419dba73910636bf2c1a691c/lang/java/pom.xml#L307-L334

So do you want to propose a PR for parent?
Thanks,
Konrad


On 27. Apr 2026, at 15:27, Carsten Ziegeler <[email protected]> wrote:

Thanks, no I was not aware of this.

I am not sure if this is a good idea, getting the code I am working on 
re-formatted just because I want to run the tests, is very confusing.

I guess this would be fine if done at a later state, after the tests - but then 
I guess it doesnt fit the maven lifecycle.

And before someone mentions this :) I dont want to specify a 
"-DDO_NOT_REFORMAT" everytime I am running maven

Regards
Carsten

On 4/24/2026 1:18 PM, Stefan Seifert wrote:
are you aware of the latest change to the parent pom from konrad (not released 
yet) [1]
it autoformats the code if the build is run locally, so it should solve the 
problem altogether?
stefan
[1] https://issues.apache.org/jira/browse/SLING-13125
-----Original Message-----
From: Carsten Ziegeler <[email protected]>
Sent: Friday, April 24, 2026 8:46 AM
To: [email protected]
Subject: Moving spotless check to a later phase?

The spotless maven plugin as configured in the parent pom runs in a very
early phase which makes it really annoying to work on code, especially
fixing tests.
Before the tests are run the spotless plugin complains about formatting
issues.

Couldnt we move this to a later phase like verify?

Carsten
--
Carsten Ziegeler
Adobe
[email protected]

--
Carsten Ziegeler
Adobe
[email protected]





--
Carsten Ziegeler
Adobe
[email protected]

Reply via email to