import: Entry[import from realm ClassRealm[maven.api, parent: null]]
chakpongchung opened this issue · comments
What steps will reproduce the problem?
Steps to reproduce the behavior:
- add the maven plugin as described in https://github.com/Cosium/git-code-format-maven-plugin to a maven file.
mvn git-code-format:format-code -Dgcf.globPattern=**/*
What is the expected output?
mvn git-code-format:format-code
successfully generate a pre-commit file for git so I can format the code.
What happens instead?
(pokeai) cpchung@cpchung:~/.../CypherANTLR$ mvn git-code-format:format-code
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for org.example:patternmatch:jar:1.0-SNAPSHOT
[WARNING] 'dependencies.dependency.version' for org.testng:testng:jar is either LATEST or RELEASE (both of them are being deprecated) @ line 87, column 22
[WARNING] 'dependencies.dependency.version' for org.projectlombok:lombok:jar is either LATEST or RELEASE (both of them are being deprecated) @ line 93, column 22
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.projectlombok:lombok:jar -> version RELEASE vs 1.18.16 @ line 96, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ----------------------< org.example:patternmatch >----------------------
[INFO] Building patternmatch 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- git-code-format-maven-plugin:4.2:format-code (default-cli) @ patternmatch ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.202 s
[INFO] Finished at: 2023-01-10T12:03:08-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.cosium.code:git-code-format-maven-plugin:4.2:format-code (default-cli) on project patternmatch: Execution default-cli of goal com.cosium.code:git-code-format-maven-plugin:4.2:format-code failed: com.google.googlejavaformat.java.FormatterException: error: Imports not contiguous (perhaps a comment separates them?) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
Is it something from cosium side?
Environment:
- OS: ubuntu 20.04
- Git version: 2.39
- git-code-format-maven-plugin version: 4.2
- Maven version: 3.8.7 with jdk 17
Link to a git repository that can be cloned to reproduce the problem:
https://github.com/pokeai/k8s_setup
Additional context
Add any other context about the problem here.
com.google.googlejavaformat.java.FormatterException
is produced by https://github.com/google/google-java-format
Is it supported to run some commands with mvn or shell script to format the code?
Or cosium only support validating whether all files are formatted?
Well, for some reasons some of the import cannot be formatted using:
mvn git-code-format:format-code -Dgcf.globPattern=**/*
I manually formatted those files first and now the command works. The repo can reproduce this problem.