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

Add deprecation notice for Java<11. #4347

Merged
merged 3 commits into from Mar 23, 2022
Merged

Add deprecation notice for Java<11. #4347

merged 3 commits into from Mar 23, 2022

Conversation

yuchenshi
Copy link
Member

@yuchenshi yuchenshi commented Mar 21, 2022

Description

This PR checks the Java version before starting emulators that require Java, and warns if Java version <= 11 or cannot be determined.

As a side effect, this also catches situations where the java command is not actually Java, and fixes #4116.

Scenarios Tested

Manually tested emulators:start and emulators:exec with Java 11 and Java 8. Only Java 8 leads to warnings. Tried to empty PATH and got the Java not installed error as expected.

Could use some help testing on OS X WITHOUT Java.

Sample Commands

$ firebase emulators:start
⚠  emulators: Support for Java version <= 10 will be dropped soon in firebase-tools@11.Please upgrade to Java version 11 or higher to continue using the emulators.
<snip>

┌─────────────────────────────────────────────────────────────┐
│ ✔  All emulators ready! It is now safe to connect your app. │
│ i  View Emulator UI at http://localhost:4000                │
└─────────────────────────────────────────────────────────────┘

┌────────────────┬────────────────┬─────────────────────────────────┐
│ Emulator       │ Host:Port      │ View in Emulator UI             │
├────────────────┼────────────────┼─────────────────────────────────┤
│ Authentication │ localhost:9099 │ http://localhost:4000/auth      │
├────────────────┼────────────────┼─────────────────────────────────┤
│ Functions      │ localhost:5001 │ http://localhost:4000/functions │
├────────────────┼────────────────┼─────────────────────────────────┤
│ Firestore      │ 0.0.0.0:8080   │ http://localhost:4000/firestore │
├────────────────┼────────────────┼─────────────────────────────────┤
│ Database       │ localhost:9999 │ http://localhost:4000/database  │
├────────────────┼────────────────┼─────────────────────────────────┤
│ Hosting        │ localhost:5000 │ n/a                             │
├────────────────┼────────────────┼─────────────────────────────────┤
│ Storage        │ localhost:9199 │ http://localhost:4000/storage   │
└────────────────┴────────────────┴─────────────────────────────────┘
  Emulator Hub running at localhost:4400
  Other reserved ports: 4500

Issues? Report them at https://github.com/firebase/firebase-tools/issues and attach the *-debug.log files.
 
⚠  emulators: Support for Java version <= 10 will be dropped soon in firebase-tools@11.Please upgrade to Java version 11 or higher to continue using the emulators.

To increase visibility, the deprecation notice is printed again after start (or at the very end for emulators:exec).

Internal note: Crashlytics is not affected by the deprecation (i.e. keeping Java 8 support), so we're not adding a check or warnings there. (Googlers: See go/crashlytics-android-cli for more info)

Copy link
Contributor

@joehan joehan left a comment

Choose a reason for hiding this comment

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

LGTM - I can help test this on Windows 11 shortly

@joehan
Copy link
Contributor

joehan commented Mar 23, 2022

Tested this on Windows 11, and it seems to be working nicely:
Error: Could not spawn 'java --version'. Please make sure Java is installed and on your system path

@yuchenshi yuchenshi enabled auto-merge (squash) March 23, 2022 23:32
@yuchenshi yuchenshi merged commit 588eba3 into master Mar 23, 2022
@yuchenshi yuchenshi deleted the ys/java-deprecation branch March 23, 2022 23:52
@michaeldebetaz
Copy link

Thanks for the warning! I followed the link from the Firebase documentation and installed openjdk-8-jre (so, just the runtime) on my WSL2 with Ubuntu and it works fine. It's however possible that I should install something else to have a more recent version of Java. and the doc is not very helpful with that.

Any tip for an easy install on Ubuntu ? My openjdk-8-jre package is already up to date.

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

Successfully merging this pull request may close these issues.

Firebase CLI doesn't properly detect JDK not being installed on macOS
3 participants