Repository navigation
Property for skipping formatting in the README doesn't match the property in the code #365
Description
Activity
None of the three (3) skip options seem to work:
- -Dspring-javaformat.skip=true
- -Dspring-javaformat.apply.skip=true
- -Dspring-javaformat.validate.skip=true
All of them fill a purpose.
Looking at https://github.com/spring-io/spring-javaformat/blob/main/spring-javaformat-maven/spring-javaformat-maven-plugin/src/main/java/io/spring/format/maven/ApplyMojo.java#L43 which used
spring-javaformat.format.skipbut that does not work either with my MRE.I think you may be misinterpreting Maven's output. When a goal is skipped, Maven will still call it and that fact that it has been called will appear in Maven's output. It is up to the goal to perform no processing when skipped. The apply and validate goals output some debug logging indicating that they have been skipped. For example:
$ mvn validate -X -Dspring-javaformat.validate.skip=true … [INFO] --- spring-javaformat-maven-plugin:0.0.38:validate (default) @ test --- [DEBUG] Configuring mojo io.spring.javaformat:spring-javaformat-maven-plugin:0.0.38:validate from plugin realm ClassRealm[plugin>io.spring.javaformat:spring-javaformat-maven-plugin:0.0.38, parent: jdk.internal.loader.ClassLoaders$AppClassLoader@531d72ca] [DEBUG] Configuring mojo 'io.spring.javaformat:spring-javaformat-maven-plugin:0.0.38:validate' with basic configurator --> [DEBUG] (f) encoding = UTF-8 [DEBUG] (f) excludes = [] [DEBUG] (f) includeGeneratedSource = false [DEBUG] (f) includes = [] [DEBUG] (f) project = MavenProject: test:test:0.1-SNAPSHOT @ /Users/awilkinson/Downloads/test-4/pom.xml [DEBUG] (f) session = org.apache.maven.execution.MavenSession@6d467c87 [DEBUG] (f) skip = true [DEBUG] (f) sourceDirectories = [/Users/awilkinson/Downloads/test-4/src/main/java] [DEBUG] (f) testSourceDirectories = [/Users/awilkinson/Downloads/test-4/src/test/java] [DEBUG] -- end configuration -- [DEBUG] skipping format validate as per configuration. [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.022 s [INFO] Finished at: 2023-02-23T09:45:51Z [INFO] ------------------------------------------------------------------------We should consider logging the skip message at info level. That's what Surefire does for example.
@wilkinsona Yes, I understand. But, the skip is not set true correctly in all cases from what I can see. Do you get
[DEBUG] (f) skip = truewhen you try to skip apply?That is,
mvn validate -X -Dspring-javaformat.apply.skip=trueI don't get
[DEBUG] (f) skip = truefor
- -Dspring-javaformat.skip=true
- -Dspring-javaformat.apply.skip=true
only for
- -Dspring-javaformat.validate.skip=true
We should consider logging the skip message at info level. That's what Surefire does for example.
Yes, agreed.
As I said in #360 (comment), you need to use
-Dspring-javaformat.format.skip=true. You will then seeskipping format apply as per configurationlogged at debug level.You'll see both
skipping format apply as per configurationandskipping format validate as per configurationlogged when using-Dspring-javaformat.skip=true. You won't see[DEBUG] (f) skip = truewhen settingspring-javaformat.skipas that's showing the value of the parameter to whichspring-javaformat.format.skipandspring-javaformat.validate.skipare mapped.Ok. Got a bit confused there. So,
-Dspring-javaformat.format.skip=truewill only skipapply?Yes.
spring-javaformat.format.skipskips apply,spring-javaformat.validate.skipskips validation, andspring-javaformat.skipskips both. Other than the mistake with the name of the property to skip apply, this is described in the README:You can use
-Dspring-javaformat.validate.skip=trueor-Dspring-javaformat.apply.skip=truecommand line arguments to temporarily skip the validation or format goals. If you want to skip both, you can use-Dspring-javaformat.skip=true.@wilkinsona Sorry for the confusion and for you having the explain several times. Have a very hectic week and it became now that I rushed things. I totally missed that
applywas replaced withformatalthough I did a cut-n-paste from your text.I would +1 to allow
spring-javaformat.apply.skipas it makes sense to be consistent with the naming of skip variables and maven goal.I messed up the property name in the code.
- added a commit that references this issue
on Feb 6, 2024
The README mentions
-Dspring-javaformat.apply.skip=truebut the code looks for-Dspring-javaformat.format.skip=true.