Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non reproducible index serialization #1642

Closed
gnodet opened this issue Mar 28, 2023 · 3 comments · Fixed by #1643
Closed

Non reproducible index serialization #1642

gnodet opened this issue Mar 28, 2023 · 3 comments · Fixed by #1643

Comments

@gnodet
Copy link
Contributor

gnodet commented Mar 28, 2023

I was experimenting with switching Apache Camel to use spotless instead of impsort/formatter plugins.
While doing so, and experimenting with the performance cost of running the spotless plugin, I realised the plugin was running again on subsequent builds.
Here's the maven output I end up with in roughly 20 out of 500 modules:

[INFO] --- spotless:2.35.0:apply (default) @ camel-seda ---
[INFO] Index file corresponds to a different configuration of the plugin. Either the plugin version or its configuration has changed. Fallback to an empty index
[INFO] Sorting file /var/folders/27/cvb78knj3xbdvty_5406llg40000gn/T/pom4948897720195268327.xml
[INFO] Pom file is already sorted, exiting
[INFO] Spotless.Pom is keeping 1 files clean - 0 were changed to be clean, 1 were already clean, 0 were skipped because caching determined they were already clean
[INFO] Spotless.Java is keeping 12 files clean - 0 were changed to be clean, 12 were already clean, 0 were skipped because caching determined they were already clean

The configuration obviously does not change, as I run the same maven command multiple times in a raw.

I thus suspect a non-reproductible serialisation issue in the Formatter.

Environment:

Apache Maven 3.9.0 (9b58d2bad23a66be161c4664ef21ce219c2c8584)
Maven home: /Users/gnodet/.sdkman/candidates/maven/3.9.0
Java version: 17.0.6, vendor: GraalVM Community, runtime: /Users/gnodet/.sdkman/candidates/java/22.3.1.r17-grl
Default locale: en_FR, platform encoding: UTF-8
OS name: "mac os x", version: "13.2.1", arch: "aarch64", family: "mac"

Not sure why, but the problem is much more easily reproducible using maven daemon, but it also happens with stock maven 3.9.0 as seen above.

Steps to reproduce:

git clone https://github.com/gnodet/camel.git
cd camel
git checkout build-improvements
mvn install -DskipTests
cd components/camel-seda
for i in $(seq 1 100)
do
    echo -n .
    mvn install -DskipTests | grep "Index file corresponds to a different configuration of the plugin"
done

the last command must be run continuously until the line Index file corresponds to a different configuration of the plugin appears.

@gnodet
Copy link
Contributor Author

gnodet commented Mar 28, 2023

I can't reproduce the problem with maven 3.9.1

➜  camel-seda git:(build-improvements) for i in $(seq 1 100)
do
    echo -n .
    ~/.sdkman/candidates/maven/3.9.1/bin/mvn install -DskipTests | grep "Index file corresponds to a different configuration of the plugin"
done

....................................................................................................%                                                                                                            

@gnodet
Copy link
Contributor Author

gnodet commented Mar 28, 2023

The problem seems to come from the order in which formatters are stored in the list to compute the checksum. I have two formatters and sometime the order is Java, Pom, while in some other cases, I have Pom, Java...

@nedtwigg
Copy link
Member

nedtwigg commented Apr 6, 2023

Fixed in plugin-maven 2.36.0, thanks to @gnodet!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants