I have a child project Project C
which has a dependency on the Maven's Bill of Materials (BOM) parent project Project P
. The parent project Project P
contains some of the code styles and formatting which needs to be applied to all the child project.
I do not which to apply these code styles to my child project Project C
due to which when I run the mvn clean install
on the child project Project C
, I get the error:
An API incompatibility was encountered while executing com.cosium.code:git-code-format-maven-plugin:3.4:validate-code-format: java.lang.IllegalAccessError: class com.google.googlejavaformat.java.JavaInput (in unnamed module @0x56da96b3) cannot access class com.sun.tools.javac.parser.Tokens$TokenKind
Full error for the reference:
[ERROR] Failed to execute goal com.cosium.code:git-code-format-maven-plugin:3.4:validate-code-format (validate-code-format) on project project-c: Execution validate-code-format of goal com.cosium.code:git-code-format-maven-plugin:3.4:validate-code-format failed:
An API incompatibility was encountered while executing com.cosium.code:git-code-format-maven-plugin:3.4:validate-code-format: java.lang.IllegalAccessError: class com.google.googlejavaformat.java.JavaInput (in unnamed module @0x4a320414)
cannot access class com.sun.tools.javac.parser.Tokens$TokenKind (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.parser to unnamed module @0x4a320414
I would like to turn off the checkstyle option in maven and would like to build the project. How to achieve this? I tried some of the answers mentioned here such as: https://stackoverflow.com/a/70023748/7584240 but it does not seem to work for me at all and getting the same error. Please suggest some work-arounds to this issue.
If I remove the plugin: with groupId com.cosium.code
and artifact ID: git-code-format-maven-plugin
but I do not wish to make any change to parent project rather handle everything in child project.
**Updated: **
After making some changes based on the documentation, I am getting the error for only one particular file. I am not sure why am I getting that error because it should skip the checking of the formatting for all the file. I tried to format that file as per intellij formatting but still build is failing.
I have added following to my pom.xml as per documentation:
<plugin>
<groupId>com.cosium.code</groupId>
<artifactId>git-code-format-maven-plugin</artifactId>
<version>${git-code-format-maven-plugin.version}</version>
<configuration>
<skip>true</skip>
<googleJavaFormatOptions>
<aosp>false</aosp>
</googleJavaFormatOptions>
</configuration>
</plugin>