java-sdk icon indicating copy to clipboard operation
java-sdk copied to clipboard

Why checkstyle failed if I added test in mvn command?

Open skyao opened this issue 1 year ago • 3 comments

Expected Behavior

Following two mvn commands I expected them are equals, because install will reply on compile and test.

mvn clean install
mvn clean test install

Actual Behavior

mvn clean install command will succeed, but mvn clean test install will fail:

mvn clean test install
......
[WARNING] target/generated-sources/io/dapr/v1/CommonProtos.java:[8272,62] (whitespace) OperatorWrap: '+' should be on a new line.
[WARNING] target/generated-sources/io/dapr/v1/CommonProtos.java:[8273,7] (indentation) Indentation: 'array initialization' child has incorrect indentation level 6, expected level should be one of the following: 8, 10.
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] dapr-sdk-parent 1.11.0-SNAPSHOT .................... SUCCESS [  1.130 s]
[INFO] dapr-sdk-autogen 1.11.0-SNAPSHOT ................... FAILURE [ 14.571 s]
[INFO] dapr-sdk 1.11.0-SNAPSHOT ........................... SKIPPED
[INFO] dapr-sdk-actors 1.11.0-SNAPSHOT .................... SKIPPED
[INFO] dapr-sdk-workflows 0.11.0-SNAPSHOT ................. SKIPPED
[INFO] dapr-sdk-springboot 1.11.0-SNAPSHOT ................ SKIPPED
[INFO] dapr-sdk-examples 1.11.0-SNAPSHOT .................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  15.920 s
[INFO] Finished at: 2023-12-14T08:05:21Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:3.1.1:check (validate) on project dapr-sdk-autogen: You have 18455 Checkstyle violations. -> [Help 1]

I even checked the code in end of 2022 year. This issue reappeared.

The root cause is that maven checkstyle plugin will check the generated code and then failed for violations for command "mvn clean test install". But if the command is "mvn clean install", maven checkstyle plugin won't check generated code.

Steps to Reproduce the Problem

  1. clone java-sdk repo and checkout to master branch
  2. run mvn clean test install

skyao avatar Dec 14 '23 08:12 skyao