Doesnt build on a java >= 9 modular project
[REQUIRED] Step 2: Describe your environment
- Operating System version: Windows 10
- java version : 19
- Firebase SDK version: 9.1.1
- Library version: 9.1.1
- Firebase Product: admin-java
[REQUIRED] Step 3: Describe the problem
I want to have a project to use JavaFX so I need the module system to work.
With a module-info.java at the root of the code, having a import com.google.firebase.FirebaseApp; won't even work if you don't add a requires firebase.admin in the module declaration.
But then you get hundreds of errors
Steps to reproduce:
- Create a java project in intellij with the javaFX preset,
- add
implementation ('com.google.firebase:firebase-admin:9.1.1')in the build.gradle - add
requires firebase.adminin themodule-info.java - try to build
- hundreds of errors of the kind
the unnamed module reads package com.google.longrunning from both gax.grpc and proto.google.common.protos
Remarks
A fix for this is to state that this SDK works on Java 8 exclusively and isn't compatible with JavaFX https://github.com/firebase/firebase-admin-java#supported-java-versions
An fix for end users is suggested here https://medium.com/@ygge/firebase-in-java-9-with-modules-9a4eb99cffcb
A hack to have JavaFX working on a non modular java project is explained here : https://edencoding.com/runtime-components-error/
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
If I understand correctly Java FX is a framework to build client applications. It is not recommended to use Firebase Admin SDK on client side as the SDK is designed to be used in privileged sever environments with admin rights.