我很難將我的自定義 jar 添加到 gwt 編譯器。
我檢查了大量的互聯網,但找不到答案。我找到了將 module.gwt.xml 檔案添加到此自定義 jar 庫并將其匯入我的 gwt 應用 app.gwt.xml 的解決方案,如下所示:<inherits name="com.ia.ia"/>
但這將使我的自定義 java 庫 gwt 知道,這對我來說是反模式。因為我將使用 gwt 破壞后端公共庫(這只是 UI 細節)。
我想遵循<source path='maintenance'/>輸入方法,但我只能為本地 java 類配置它。我不知道如何為外部 jar 執行此操作。
請幫忙
以下是我已經完成的步驟:
我已將源插件添加到我的自定義 jar 的 pom.xml 中,如下所示:
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>package</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
因此自定義 jar 構建會生成 2 個 jar,正常的和帶有源的。
我已將依賴項添加到我的 gwt 專案 ui/pom.xml
<dependency>
<groupId>com.ia</groupId>
<artifactId>ia-maintenance-api</artifactId>
<version>${qiasphere-maintenance.version}</version>
</dependency>
<dependency>
<groupId>com.ia</groupId>
<artifactId>ia-maintenance-api</artifactId>
<version>${ia-maintenance.version}</version>
<classifier>sources</classifier>
</dependency>
當我編譯 gwt 時出現錯誤:
[INFO] [ERROR] 第 16 行:com.ia.maintenance.api.network.wifi.WifiSecurityType 型別沒有可用的源代碼;你忘了繼承一個必需的模塊嗎?
這是我的 gwt UI 應用程式模塊檔案:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.9.0//EN"
"http://gwtproject.org/doctype/2.9.0/gwt-module.dtd">
<module rename-to="app">
<inherits name='com.google.gwt.user.User'/>
<inherits name="com.google.gwt.editor.Editor"/>
<inherits name="com.google.gwt.i18n.I18N"/>
<inherits name='com.github.nalukit.nalu.Nalu'/>
<inherits name='com.github.nalukit.nalu.plugin.elemental2.NaluPluginElemental2'/>
<inherits name='org.dominokit.domino.ui.DominoUI'/>
<inherits name="org.dominokit.rest.Rest"/>
<inherits name="org.jresearch.threetenbp.gwt.time.module"/>
<entry-point class='com.ia.ia.app.ui.APP'/>
<!-- Specify the paths for translatable code (java and java script) -->
<source path='ui'/>
<source path='shared'/>
</module>
自定義 jar 庫沒有任何 module.gwt.xml 檔案,因為我不想破壞帶有前端詳細資訊的簡單后端 jar。
所以我需要在 gwt ui 應用程式中配置它。
也許一些 maven 插件將從這個自定義 jar 庫中獲取源 *.java 檔案并將其放在目標目錄中,例如:target/classes/com.ia.ia.maintenance所以 gwt 編譯器可以拾取它?
uj5u.com熱心網友回復:
您不需要修改 jar,只需在您自己的專案/客戶端模塊中創建一個 gwt.xml 檔案,該檔案的源標記指向 pojos 包。
我要做的是在我的客戶端模塊中創建一個包com.ia.ia.maintenance并在那里添加一個新的 gwt.xmlMaintenance.gwt.xml
<?xml version="1.0" encoding="UTF-8"?>
<module>
<source path="" />
</module>
現在在您自己的應用程式 gwt.xml 中,您繼承了這個新模塊。
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/405489.html
標籤:
上一篇:SpringBootMaven插件-如何使用Javajar檔案和腳本構建一個zip檔案來運行它?
下一篇:如何在兩個鍵上對這個串列進行排序
