You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After further debugging, it seems like the root issue is spotless swapping the ordering of executions.
When copy-sources execution is moved to be after autoreconf execution, it will cause build failure as the sources used by autoreconf are not yet available at the expected location.
It seems like Spotless reorders the executions alphabetically based on execution id. By changing the id of copy-sources to acopy-sources, spotless no longer tries to swap the execution ordering.
Describe the bug
When spotless is applied to pom.xml in certain cases it can break the plugin configuration.
Expected behavior
Spotless is expected to make changes that don't affect the functionality of the code.
How to reproduce
Problematic plugin before applying spotless (builds correctly):
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>3.1.0</version> <executions> <execution> <id>copy-sources</id> <phase>process-sources</phase> <goals> <goal>exec</goal> </goals> <configuration> <executable>cp</executable> <arguments> <argument>-a</argument> <argument>${project.build.directory}/../src/main/c/.</argument> <argument>.</argument> </arguments> <workingDirectory>${project.build.directory}/${project.artifactId}/src/main/c</workingDirectory> </configuration> </execution> <execution> <id>autoreconf</id> <phase>process-sources</phase> <goals> <goal>exec</goal> </goals> <configuration> <executable>autoreconf</executable> <arguments> <argument>-fvi</argument> </arguments> <workingDirectory>${project.build.directory}/${project.artifactId}/src/main/c</workingDirectory> </configuration> </execution> <execution> <id>configure</id> <phase>process-sources</phase> <goals> <goal>exec</goal> </goals> <configuration> <executable>./configure</executable> <arguments> <argument>--prefix=/</argument> <argument>--libdir=/</argument> </arguments> <workingDirectory>${project.build.directory}/${project.artifactId}/src/main/c</workingDirectory> </configuration> </execution> <execution> <id>make</id> <phase>process-sources</phase> <goals> <goal>exec</goal> </goals> <configuration> <executable>make</executable> <arguments> <argument>-j1</argument> </arguments> <workingDirectory>${project.build.directory}/${project.artifactId}/src/main/c</workingDirectory> </configuration> </execution> <execution> <id>make-install</id> <phase>process-sources</phase> <goals> <goal>exec</goal> </goals> <configuration> <executable>make</executable> <arguments> <argument>-j1</argument> <argument>install</argument> <argument>DESTDIR=${project.build.directory}/classes</argument> </arguments> <workingDirectory>${project.build.directory}/${project.artifactId}/src/main/c</workingDirectory> </configuration> </execution> </executions> </plugin>
Result after applying Spotless, unable to build (autoreconf: error: 'configure.ac' is required):
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>3.1.0</version> <executions> <execution> <id>autoreconf</id> <goals> <goal>exec</goal> </goals> <phase>process-sources</phase> <configuration> <executable>autoreconf</executable> <arguments> <argument>-fvi</argument> </arguments> <workingDirectory>${project.build.directory}/${project.artifactId}/src/main/c</workingDirectory> </configuration> </execution> <execution> <id>configure</id> <goals> <goal>exec</goal> </goals> <phase>process-sources</phase> <configuration> <executable>./configure</executable> <arguments> <argument>--prefix=/</argument> <argument>--libdir=/</argument> </arguments> <workingDirectory>${project.build.directory}/${project.artifactId}/src/main/c</workingDirectory> </configuration> </execution> <execution> <id>copy-sources</id> <goals> <goal>exec</goal> </goals> <phase>process-sources</phase> <configuration> <executable>cp</executable> <arguments> <argument>-a</argument> <argument>${project.build.directory}/../src/main/c/.</argument> <argument>.</argument> </arguments> <workingDirectory>${project.build.directory}/${project.artifactId}/src/main/c</workingDirectory> </configuration> </execution> <execution> <id>make</id> <goals> <goal>exec</goal> </goals> <phase>process-sources</phase> <configuration> <executable>make</executable> <arguments> <argument>-j1</argument> </arguments> <workingDirectory>${project.build.directory}/${project.artifactId}/src/main/c</workingDirectory> </configuration> </execution> <execution> <id>make-install</id> <goals> <goal>exec</goal> </goals> <phase>process-sources</phase> <configuration> <executable>make</executable> <arguments> <argument>-j1</argument> <argument>install</argument> <argument>DESTDIR=${project.build.directory}/classes</argument> </arguments> <workingDirectory>${project.build.directory}/${project.artifactId}/src/main/c</workingDirectory> </configuration> </execution> </executions> </plugin>
Software version
Spotless 2.30.0
The text was updated successfully, but these errors were encountered: