[英]how to export a javafx-maven project with firebase
現在我已經讓我的項目在mvn javafx:run
上運行。 但是執行mvn javaFx:jlink
需要模塊描述符。 創建模塊信息文件后,有一些與 firebase 相關的錯誤。
一些進口進口:
import com.google.api.core.ApiFuture;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.cloud.firestore.*;
import com.google.firebase.FirebaseApp;
import com.google.firebase.FirebaseOptions;
在模塊信息文件中需要:
requires com.google.api.apicommon;
requires com.google.auth.oauth2;
requires firebase.admin;
requires google.cloud.firestore;
錯誤:
[ERROR] Failed to execute goal org.openjfx:javafx-maven-plugin:0.0.3:run (default-cli) on project RathnapuraLabs: Error: Unable to execute mojo: Compilation failure:
[ERROR] /C:/Users/Eshaka/IdeaProjects/RathnapuraLabs/src/main/java/back_end/TestManager.java:[14,35] cannot access com.google.cloud.Service
[ERROR] class file for com.google.cloud.Service not found
[ERROR] /C:/Users/Eshaka/IdeaProjects/RathnapuraLabs/src/main/java/back_end/DBHandler.java:[69,33] cannot access com.google.auth.Credentials
[ERROR] class file for com.google.auth.Credentials not found
[ERROR] /C:/Users/Eshaka/IdeaProjects/RathnapuraLabs/src/main/java/back_end/DBHandler.java:[100,85] cannot access com.google.cloud.Timestamp
[ERROR] class file for com.google.cloud.Timestamp not found
我該如何解決這個錯誤?
我想出了一個更簡單的方法來導出所有依賴項和所有(包括firebase)。 只需將maven-shape-plugin
用於 package。
將以下插件添加到 pom.xml
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>3.0.0</version> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> <configuration> <transformers> <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> <mainClass>Launcher</mainClass> </transformer> </transformers> </configuration> </execution> </executions> </plugin>
您需要創建另一個 class 主調用主 function 的主 javafx ZA2F2ED4F8DCEBC2CBBDZ21A2 擴展下面的應用程序
public class Launcher { public static void main(String[] args) { AppInit.main(args); } }
最后運行mvn clean package
我之前確實遇到過類似的問題,這表明您在 pom.xml 中缺少一些依賴項:
[ERROR] class file for com.google.cloud.Service not found
[ERROR] class file for com.google.auth.Credentials not found
[ERROR] class file for com.google.cloud.Timestamp not found
確保你包括他們。 您可以在此處看到類似的問題。 確保在包含依賴項后解決所有沖突,否則您將獲得:
模塊“com.example”從“package.example”和“package.example”中讀取 package“package”
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.