TL;DR:如何構建一個 Gluon 應用程式作為更大的多模塊專案的一部分?
我有一個多模塊的 Mave 專案(即我的頂級 POM 有“ <packaging>pom</packaging>”)。該專案包含一堆庫和相關的子專案,其中一個是我的實際用戶安裝的 Gluon 應用程式。(專案的其余部分是客戶端應用程式連接到的所有云托管管道。)
當我嘗試構建 Gluon 應用程式時,根據Gluon 檔案,我收到以下錯誤:
mvn gluonfx:build
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] app [pom]
[INFO] app-common [jar]
[INFO] app-server [jar]
[INFO] app-client [jar]
[INFO] app-test [jar]
[INFO] app-utilities [jar]
[INFO] app-integration-lambda [jar]
[INFO] app-integration-jakarta [war]
[INFO] app-gluon [jar]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for app 0.9:
[INFO]
[INFO] app ............................................ SKIPPED
[INFO] app-common ..................................... SKIPPED
[INFO] app-server ..................................... SKIPPED
[INFO] app-client ..................................... SKIPPED
[INFO] app-test ....................................... SKIPPED
[INFO] app-utilities .................................. SKIPPED
[INFO] app-integration-lambda ......................... SKIPPED
[INFO] app-integration-jakarta ........................ SKIPPED
[INFO] app-gluon ...................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.298 s
[INFO] Finished at: 2022-02-22T21:03:18 01:00
[INFO] ------------------------------------------------------------------------
[ERROR] No plugin found for prefix 'gluonfx' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (C:\Users\Administrator\.m2\repository), central (https://repo.maven.apache.org/maven2)] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoPluginFoundForPrefixException
如果我運行 Maven 以便它只構建 Gluon 應用程式,如下所示:
mvn gluonfx:build --projects "app-gluon" --also-make
我得到基本相同的錯誤。如果我先 cd 到 app-gluon,我會得到一個不同的錯誤(而且我沒想到這會起作用):
cd app-gluon
mvn gluonfx:build
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------< com.whatever:app-gluon >--------------------
[INFO] Building app-gluon 0.9
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for com.whatever:app-common:jar:0.9 is missing, no dependency information available
[WARNING] The POM for com.whatever:app-client:jar:0.9 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.380 s
[INFO] Finished at: 2022-02-22T21:09:12 01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project app-gluon: Could not resolve dependencies for project com.whatever:app-gluon:jar:0.9: The following artifacts could not be
resolved: com.whatever:app-common:jar:0.9, com.whatever:app-client:jar:0.9: com.whatever:app-common:jar:0.9 was not found in https://nexus.gluonhq.com/nexus/
content/repositories/releases during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of Gluon has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
所以我的問題是:如何構建一個作為更大的多模塊專案一部分的 Gluon 應用程式?
uj5u.com熱心網友回復:
如果您有一個多模塊專案,并且您的 app 模塊依賴于其他模塊,您需要將這些模塊發布到存盤庫,以便 app 模塊找到它們,就像任何其他第三方依賴項一樣。
通常,對于本地開發,您可以簡單地使用mvn install從根檔案夾在本地部署您的專案。當然,對于分發,您應該考慮將它們發布到可訪問的存盤庫。
確保您的所有模塊都部署到您的~/.m2存盤庫。
然后你可以從根目錄運行:
mvn gluonfx:build -f app-gluon
或進入 app-gluon 檔案夾:
cd app-gluon
mvn gluonfx:build
請記住,每次對其他模塊進行任何更改時,都需要在構建本機映像之前再次發布它們。
此外,由于您可以在 JVM 上運行您的應用程式,因此在構建本機映像(需要幾分鐘)之前,您可以簡單地運行和測驗:
mvn gluonfx:run
如果效果很好,請進行本機映像構建。
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/431664.html
