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

Bind to maven phase is not working #2112

Open
thahgr opened this issue May 14, 2024 · 0 comments
Open

Bind to maven phase is not working #2112

thahgr opened this issue May 14, 2024 · 0 comments

Comments

@thahgr
Copy link

thahgr commented May 14, 2024

If you are submitting a bug, please include the following:

Summary:
Applying the spotless maven plugin to specific phases is not working. For example, having binded check to validate phase and apply to verify, running verify also applies spotless.
Plugin goals run correctly individually eg mvn spotless:check

public git repo with example: https://gitlab.com/thahgr/spotless-maven-phases-test

to reproduce

  • modify a file adding an incorrect identation (eg new line)
  • run mvn verify

expected: the command should fail because spotless check failed
actual: the command succeeds while writing files with spotless::apply

versions:
maven: 3.8.1
java: 17
spotless: 2.43.0
google-java-plugin: 1.22.0
os: Ubuntu 22.04.4 LTS

Spotless configuration

<configuration>
    <java>
        <importOrder/>
        <removeUnusedImports/>
        <googleJavaFormat>
            <version>${google.java.format.version}</version>
            <style>GOOGLE</style>
            <reflowLongStrings>true</reflowLongStrings>
        </googleJavaFormat>
    </java>
    <lineEndings>UNIX</lineEndings>
</configuration>
<executions>
    <execution>
        <id>spotless-check</id>
        <goals>
            <goal>check</goal>
        </goals>
        <phase>verify</phase>
    </execution>
    <execution>
        <id>spotless-apply</id>
        <goals>
            <goal>apply</goal>
        </goals>
        <phase>validate</phase>
    </execution>
</executions>
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

No branches or pull requests

1 participant