Description
Using Maven 3.6.3, Spotless maven plugin 2.9.0, Eclipse WTP 4.7.3a.
I'm trying out the Spotless/WTP combo for format XML files in the GeoServer project, it's failing with parallel builds with error messages like this one (due to parallel build, some other message is in the mix, sorry about it):
mar 20, 2021 5:31:46 PM com.diffplug.spotless.FormatExceptionPolicyLegacy error
GRAVE: Step 'eclipse wtp formatters - XML' found problem in 'src/main/java/applicationContext.xml':
null
[ava.lang.reflect.InvocationTargetException
34mINFO] Installing /home at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
/aaime/devel/git-gs-cle at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
an/src/ows/target/gs-ows- at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
2.20-SNAPSHOT.jar at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
to /home/aaime/.m2/reposi at com.diffplug.spotless.extra.wtp.EclipseWtpFormatterStep.applyWithFile(EclipseWtpFormatterStep.java:75)
tory/org/geoserver/gs-ows/2 at com.diffplug.spotless.extra.wtp.EclipseWtpFormatterStep.lambda$createBuilder$0(EclipseWtpFormatterStep.java:51)
.20-SNAPSHOT/gs-ows-2. at com.diffplug.spotless.FormatterStepImpl$Standard.format(FormatterStepImpl.java:76)
20-SNAPSHOT.jar
at com.diffplug.spotless.FormatterStep$Strict.format(FormatterStep.java:76)
at com.diffplug.spotless.Formatter.compute(Formatter.java:230)
at com.diffplug.spotless.PaddedCell.calculateDirtyState(PaddedCell.java:201)
at com.diffplug.spotless.PaddedCell.calculateDirtyState(PaddedCell.java:188)
at com.diffplug.spotless.maven.SpotlessApplyMojo.process(SpotlessApplyMojo.java:45)
at com.diffplug.spotless.maven.AbstractSpotlessMojo.execute(AbstractSpotlessMojo.java:146)
at com.diffplug.spotless.maven.AbstractSpotlessMojo.execute(AbstractSpotlessMojo.java:137)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call(MultiThreadedBuilder.java:190)
at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call(MultiThreadedBuilder.java:186)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
[Caused by: java.lang.NullPointerException
at com.diffplug.spotless.extra.eclipse.wtp.EclipseXmlFormatterStepImpl.<init>(EclipseXmlFormatterStepImpl.java:62)
I ... 27 more
N
FO] Installing /home/aaime/devel/git-gs-clean/src/ows/pom.xml to /home/aaime/.m2/repository/org/geoserver/gs-ows/2.20-SNAPSHOT/gs-ows-2.20-SNAPSHOTmar 20, 2021 5:31:46 PM com.diffplug.spotless.FormatExceptionPolicyLegacy error
.poGRAVE: Step 'eclipse wtp formatters - XML' found problem in 'src/main/resources/applicationContext.xml':
null
mjava.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.diffplug.spotless.extra.wtp.EclipseWtpFormatterStep.applyWithFile(EclipseWtpFormatterStep.java:75)
at com.diffplug.spotless.extra.wtp.EclipseWtpFormatterStep.lambda$createBuilder$0(EclipseWtpFormatterStep.java:51)
at com.diffplug.spotless.FormatterStepImpl$Standard.format(FormatterStepImpl.java:76)
at com.diffplug.spotless.FormatterStep$Strict.format(FormatterStep.java:76)
at com.diffplug.spotless.Formatter.compute(Formatter.java:230)
at com.diffplug.spotless.PaddedCell.calculateDirtyState(PaddedCell.java:201)
at com.diffplug.spotless.PaddedCell.calculateDirtyState(PaddedCell.java:188)
at com.diffplug.spotless.maven.SpotlessApplyMojo.process(SpotlessApplyMojo.java:45)
at com.diffplug.spotless.maven.AbstractSpotlessMojo.execute(AbstractSpotlessMojo.java:146)
at com.diffplug.spotless.maven.AbstractSpotlessMojo.execute(AbstractSpotlessMojo.java:137)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call(MultiThreadedBuilder.java:190)
at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call(MultiThreadedBuilder.java:186)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException
at com.diffplug.spotless.extra.eclipse.wtp.EclipseXmlFormatterStepImpl.<init>(EclipseXmlFormatterStepImpl.java:62)
... 27 more
A testable branch with full configuration is here:
https://github.com/aaime/geoserver/tree/spotless-wtp
Runining the pluging directly won't work, as the "initialize" phase does not seem to be invoked, we use it to set a property
containing the location of the config files (including spotless one). I don't have the same problem with other plugins, such as PMD, checkstyle and the like, not sure what's different about spotless.
Forcing maven to run the process-sources
phase seems to do the trick, it goes through initialize first, and then :
mvn process-sources -nsu -T6 -fae -Prelease,communityRelease
The extra profiles bring into the build all optional modules, totalling 200+ Maven modules, on my machine it won't fail with less than that. The -T6
makes maven use 6 out of the 8 available cores (Ryzen 1700+, 8 actual phisical cores). Found it fails with -T4
though.