Skip to content
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

[BUILD] pin Maven compiler target version to Java 8 and remove explict compiler release version #6766

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bowenliang123
Copy link
Contributor

🔍 Description

Issue References 🔗

This pull request fixes #

Describe Your Solution 🔧

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Types of changes 🔖

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Test Plan 🧪

Behavior Without This Pull Request ⚰️

Behavior With This Pull Request 🎉

Related Unit Tests


Checklist 📝

Be nice. Be informative.

@bowenliang123 bowenliang123 changed the title pin Maven compiler release version to Java 8 [BUILD] pin Maven compiler release version to Java 8 Oct 21, 2024
@codecov-commenter
Copy link

codecov-commenter commented Oct 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 0.00%. Comparing base (e0a80f2) to head (0114f56).

Additional details and impacted files
@@          Coverage Diff           @@
##           master   #6766   +/-   ##
======================================
  Coverage    0.00%   0.00%           
======================================
  Files         684     684           
  Lines       42354   42354           
  Branches     5776    5776           
======================================
  Misses      42354   42354           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pan3793
Copy link
Member

pan3793 commented Oct 22, 2024

since we set parent pom to org.apache:apache:33, we don't need to define those properties again, just follow apache/maven-apache-parent@ded34a8 to override maven.compiler.target then everything is fine.

@bowenliang123
Copy link
Contributor Author

bowenliang123 commented Oct 22, 2024

since we set parent pom to org.apache:apache:33, we don't need to define those properties again, just follow apache/maven-apache-parent@ded34a8 to override maven.compiler.target then everything is fine.

SGTM. Applied a similar patch to our pom. And it could be removed when apache parent pom 34 released in the future.

@bowenliang123 bowenliang123 changed the title [BUILD] pin Maven compiler release version to Java 8 [BUILD] pin Maven compiler target version to Java 8 and remove explict compiler release version Oct 22, 2024
@bowenliang123 bowenliang123 added this to the v1.10.0 milestone Oct 22, 2024
@bowenliang123 bowenliang123 self-assigned this Oct 22, 2024
@bowenliang123
Copy link
Contributor Author

bowenliang123 commented Oct 22, 2024

Builds failed for missing class/package sun.misc.Signal with error logs:
https://github.com/apache/kyuubi/actions/runs/11452487137/job/31863464278?pr=6766#step:9:197

Error: ] /home/runner/work/kyuubi/kyuubi/kyuubi-common/src/main/scala/org/apache/kyuubi/util/SignalRegister.scala:26: not found: object sun
Error: ] /home/runner/work/kyuubi/kyuubi/kyuubi-common/src/main/scala/org/apache/kyuubi/util/SignalRegister.scala:36: not found: type Signal
Error: ] /home/runner/work/kyuubi/kyuubi/kyuubi-common/src/main/scala/org/apache/kyuubi/util/SignalRegister.scala:54: not found: type Signal
Error: ] /home/runner/work/kyuubi/kyuubi/kyuubi-common/src/main/scala/org/apache/kyuubi/util/SignalRegister.scala:54: not found: type SignalHandler
Error: ] /home/runner/work/kyuubi/kyuubi/kyuubi-common/src/main/scala/org/apache/kyuubi/util/SignalRegister.scala:56: not found: type SignalHandler
Error: ] /home/runner/work/kyuubi/kyuubi/kyuubi-common/src/main/scala/org/apache/kyuubi/util/SignalRegister.scala:56: not found: value Signal
Error: ] /home/runner/work/kyuubi/kyuubi/kyuubi-common/src/main/scala/org/apache/kyuubi/util/SignalRegister.scala:58: not found: type Signal
Error: ] /home/runner/work/kyuubi/kyuubi/kyuubi-common/src/main/scala/org/apache/kyuubi/util/SignalRegister.scala:59: not found: value Signal
Error: ] /home/runner/work/kyuubi/kyuubi/kyuubi-common/src/main/scala/org/apache/kyuubi/util/SignalRegister.scala:65: not found: value Signal
Error: [ERROR] 9 errors found

cc @pan3793 @wForget

@bowenliang123 bowenliang123 removed this from the v1.10.0 milestone Oct 22, 2024
@bowenliang123 bowenliang123 removed their assignment Oct 22, 2024
@pan3793
Copy link
Member

pan3793 commented Oct 22, 2024

cc @LuciferYang, could you please give some advice if you have time? thanks in advance.

@bowenliang123 bowenliang123 force-pushed the compiler-release-8 branch 4 times, most recently from 6593afe to 72c92e5 Compare October 22, 2024 05:50
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<!-- Pinning compiler target to Java 8-->
<maven.compiler.target>8</maven.compiler.target>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC,In principle, maven.compiler.source and maven.compiler.target should be set as a pair.

@LuciferYang
Copy link

LuciferYang commented Oct 22, 2024

Builds failed for missing class/package sun.misc.Signal with error logs: https://github.com/apache/kyuubi/actions/runs/11452487137/job/31863464278?pr=6766#step:9:197

Error: ] /home/runner/work/kyuubi/kyuubi/kyuubi-common/src/main/scala/org/apache/kyuubi/util/SignalRegister.scala:26: not found: object sun
Error: ] /home/runner/work/kyuubi/kyuubi/kyuubi-common/src/main/scala/org/apache/kyuubi/util/SignalRegister.scala:36: not found: type Signal
Error: ] /home/runner/work/kyuubi/kyuubi/kyuubi-common/src/main/scala/org/apache/kyuubi/util/SignalRegister.scala:54: not found: type Signal
Error: ] /home/runner/work/kyuubi/kyuubi/kyuubi-common/src/main/scala/org/apache/kyuubi/util/SignalRegister.scala:54: not found: type SignalHandler
Error: ] /home/runner/work/kyuubi/kyuubi/kyuubi-common/src/main/scala/org/apache/kyuubi/util/SignalRegister.scala:56: not found: type SignalHandler
Error: ] /home/runner/work/kyuubi/kyuubi/kyuubi-common/src/main/scala/org/apache/kyuubi/util/SignalRegister.scala:56: not found: value Signal
Error: ] /home/runner/work/kyuubi/kyuubi/kyuubi-common/src/main/scala/org/apache/kyuubi/util/SignalRegister.scala:58: not found: type Signal
Error: ] /home/runner/work/kyuubi/kyuubi/kyuubi-common/src/main/scala/org/apache/kyuubi/util/SignalRegister.scala:59: not found: value Signal
Error: ] /home/runner/work/kyuubi/kyuubi/kyuubi-common/src/main/scala/org/apache/kyuubi/util/SignalRegister.scala:65: not found: value Signal
Error: [ERROR] 9 errors found

cc @pan3793 @wForget

After version 4.7.1, the scala-maven-plugin will, by default, add the -release compilation option for newer
Scala versions, such as 2.13.9+ and possibly some newer versions of 2.12.x (I can't recall the specifics).

-release can lead to compilation errors when crossing Java versions, such as using Java APIs that are not opened(SignalHandler in Java 8 belongs to the internal API, If the target version is 9+ using SignalHandler is also visible during cross compilation). If it's not possible to avoid using them,we can try downgrading the
scala-maven-plugin to version 4.7.1 to avoid the forced addition of the -release compilation option

Ignoring the above comments, it seems that it's not the plugin that adds -release, but rather the apache-33.pom that activates the jdk9+ profile, which then uses maven.compiler.release.

 <profile>
      <id>jdk9+</id>
      <activation>
        <!-- this does not support toolchains, https://issues.apache.org/jira/browse/MNG-6943 -->
        <jdk>[9,)</jdk>
      </activation>
      <properties>
        <!-- https://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-release.html, affects m-compiler-p and m-javadoc-p -->
        <maven.compiler.release>${maven.compiler.target}</maven.compiler.release>
      </properties>
    </profile>

So, without modifying the code, when building with Java 17/21, the -release option might only be able to use a higher version, such as 11. I haven't thought of any better solutions at the moment. @pan3793

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants