Enforce java compilation version in pom
Currently, when folks try to compile pinot with any other version than java11, they get cryptic error messages. The PR adds check in enforcer plugin and triggers before any compilation happens.
e.g.
openjdk version "1.8.0_302"
OpenJDK Runtime Environment Corretto-8.302.08.1 (build 1.8.0_302-b08)
OpenJDK 64-Bit Server VM Corretto-8.302.08.1 (build 25.302-b08, mixed mode)
pranay.sankpal@ITIN000509-MAC pinot % mvn -version
Apache Maven 3.8.5 (3599d3414f046de2324203b78ddcf9b5e4388aa0)
Maven home: /usr/local/Cellar/maven/3.8.5/libexec
Java version: 18.0.1, vendor: Homebrew, runtime: /usr/local/Cellar/openjdk/18.0.1/libexec/openjdk.jdk/Contents/Home
Default locale: en_IN, platform encoding: UTF-8
OS name: "mac os x", version: "10.15.7", arch: "x86_64", family: "mac"
pranay.sankpal@ITIN000509-MAC pinot % mvn install package -DskipTests -Pbin-dist
[ERROR] Failed to execute goal com.diffplug.spotless:spotless-maven-plugin:2.9.0:check (default) on project pinot-spi: Execution default of goal com.diffplug.spotless:spotless-maven-plugin:2.9.0:check failed: java.lang.reflect.InvocationTargetException: class com.google.googlejavaformat.java.RemoveUnusedImports (in unnamed module @0x687d31a9) cannot access class com.sun.tools.javac.util.Context (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.util to unnamed module @0x687d31a9 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.diffplug.spotless:spotless-maven-plugin:2.9.0:check (default) on project pinot-spi: Execution default of goal com.diffplug.spotless:spotless-maven-plugin:2.9.0:check failed: java.lang.reflect.InvocationTargetException
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:306)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:211)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:165)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:157)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:121)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:127)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:294)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:960)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:104)
at java.lang.reflect.Method.invoke (Method.java:577)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default of goal com.diffplug.spotless:spotless-maven-plugin:2.9.0:check failed: java.lang.reflect.InvocationTargetException
Codecov Report
Merging #9139 (c29b211) into master (7197461) will decrease coverage by
8.83%. The diff coverage isn/a.
@@ Coverage Diff @@
## master #9139 +/- ##
============================================
- Coverage 37.14% 28.30% -8.84%
+ Complexity 193 51 -142
============================================
Files 1838 1826 -12
Lines 97516 97163 -353
Branches 14711 14673 -38
============================================
- Hits 36222 27505 -8717
- Misses 58360 67028 +8668
+ Partials 2934 2630 -304
| Flag | Coverage Δ | |
|---|---|---|
| integration1 | 26.20% <ø> (-0.12%) |
:arrow_down: |
| integration2 | 24.68% <ø> (-0.10%) |
:arrow_down: |
| unittests2 | ? |
Flags with carried forward coverage won't be shown. Click here to find out more.
| Impacted Files | Coverage Δ | |
|---|---|---|
| ...n/java/org/apache/pinot/query/type/TypeSystem.java | 0.00% <0.00%> (-100.00%) |
:arrow_down: |
| ...java/org/apache/pinot/query/planner/QueryPlan.java | 0.00% <0.00%> (-100.00%) |
:arrow_down: |
| ...ava/org/apache/pinot/query/validate/Validator.java | 0.00% <0.00%> (-100.00%) |
:arrow_down: |
| ...a/org/apache/pinot/query/parser/QueryRewriter.java | 0.00% <0.00%> (-100.00%) |
:arrow_down: |
| .../org/apache/pinot/query/planner/StageMetadata.java | 0.00% <0.00%> (-100.00%) |
:arrow_down: |
| ...g/apache/pinot/query/planner/stage/FilterNode.java | 0.00% <0.00%> (-100.00%) |
:arrow_down: |
| ...g/apache/pinot/query/rules/PinotQueryRuleSets.java | 0.00% <0.00%> (-100.00%) |
:arrow_down: |
| .../apache/pinot/query/planner/stage/ProjectNode.java | 0.00% <0.00%> (-100.00%) |
:arrow_down: |
| ...pache/pinot/query/planner/stage/AggregateNode.java | 0.00% <0.00%> (-100.00%) |
:arrow_down: |
| ...pache/pinot/query/planner/stage/TableScanNode.java | 0.00% <0.00%> (-100.00%) |
:arrow_down: |
| ... and 305 more |
Help us with your feedback. Take ten seconds to tell us how you rate us.
We do want to support compiling pinot with java 8 (for prestoDB connector) and versions later than 11. Seems you run into an issue when trying to compile pinot with java 18. We should fix the code so that it can compile with java 18.
It looks like com.diffplug.spotless:spotless-maven-plugin:2.9.0 maven plugin fails to run with Java version: 18.0.1, rather than compilation being broken (which is done with help of maven-compiler-plugin in maven).
Java 16+ have restricted access to internal modules and it makes sense, that older plugins that were using javas internals are failing. In order to fix build for java 18 for this plugin (there might be more things that are failing), spotless-maven-plugin needs to be updated to 2.22.8 version, according to this spotless issue.