-
Notifications
You must be signed in to change notification settings - Fork 207
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
Why checkstyle failed if I added test in mvn command? #972
Comments
I tried to find why the github action is always green without this issue, in the `.github/workflow/build.xml', I found that the script executed the mvn command of clean / compile / test / install one by one: - name: Clean up files
run: ./mvnw clean -B
- name: Build sdk
run: ./mvnw compile -B -q
- name: Unit tests
run: ./mvnw -B test -q
- name: Codecov
uses: codecov/[email protected]
- name: Install jars
run: ./mvnw install -q -B -DskipTests I tried to run these commands in local, they all passed without violations. And from the log I found that the log of checkstyle plugin: and in the second step [INFO] --- maven-checkstyle-plugin:3.1.1:check (validate) @ dapr-sdk-autogen ---
[INFO] Starting audit...
Audit done.
[INFO] You have 0 Checkstyle violations. The checkstyle plugin executed in mvn compile but no violations found. It means that at this moment, checkstyle plugin didn't check the generated source code. The github action didn't run test and install at the same time, so it's lucky and succeed. |
The checkstyle plugin will be executed in mvn compile phase, so let's change to compile and test, not install and test. I executed following three commands one by one and no error found: mvn clean
mvn compile
mvn test While I executed compile and test together: mvn clean
mvn compile test
......
......
[WARNING] target/generated-sources/io/dapr/v1/CommonProtos.java:[8272,7] (indentation) Indentation: 'array initialization' child has incorrect indentation level 6, expected level should be one of the following: 8, 10.
[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 [ 0.943 s]
[INFO] dapr-sdk-autogen 1.11.0-SNAPSHOT ................... FAILURE [ 27.961 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: 29.130 s
[INFO] Finished at: 2023-12-14T09:12:45Z
[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] |
The checkstyle plugin will behave inconsistently:
To fix it, set the sourceDirectories of checkstyle configuration to only sourceDirectory: <sourceDirectories>
<sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
</sourceDirectories> |
@artursouza this looks solved too.. can we close it? |
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, butmvn clean test install
will fail: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
mvn clean test install
The text was updated successfully, but these errors were encountered: