[英]GWT Maven Multi Module
我創建了一個具有以下結構的GWT Maven多模塊項目。
核心模塊[包含活動,演示者,共享資源] core.gwt.xml和入口點
core.gwt.xml
<inherits name='com.google.gwt.user.User' />
<!-- We need the JUnit module in the main module, -->
<!-- otherwise eclipse complains (Google plugin bug?) -->
<!--<inherits name='com.google.gwt.junit.JUnit' /> -->
<!-- Inherit the default GWT style sheet. You can change -->
<!-- the theme of your GWT application by uncommenting -->
<!-- any one of the following lines. -->
<!--inherits name='com.google.gwt.user.theme.standard.Standard' /> -->
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
<!-- <stylesheet src="styles-global.css"/> -->
<!--GWT-QUERY -->
<!-- <inherits name='com.google.gwt.query.Query'/> -->
<!--SuperDev Mode -->
<!-- add-linker name="xsiframe"/> <set-configuration-property name="devModeRedirectEnabled"
value="true"/-->
<set-property name="user.agent" value="gecko1_8,safari" />
<!-- Other module inherits -->
<!-- We need the MVP stuff (Activity and Place -->
<!-- I am also using DepInj with Gin (Inject) -->
<!-- and Resource for client bundle and stuff (not used yet) -->
<inherits name="com.google.gwt.activity.Activity" />
<inherits name="com.google.gwt.place.Place" />
<inherits name="com.google.gwt.inject.Inject" />
<inherits name="com.google.gwt.resources.Resources" />
<inherits name="com.google.gwt.user.Debug" />
<inherits name="org.fusesource.restygwt.RestyGWT"/>
<!-- gwtbootstrap3 -->
<inherits name="com.template.resources.CustomBootstrap"/>
<!-- Specify the app entry point class. -->
<entry-point class='com.template.core.client.template' />
<!-- Specify the paths for translatable code -->
<source path='client' />
<source path='shared' />
<!-- Form Factors -->
<inherits name="com.template.core.FormFactor" />
<!-- For JSON Ajax call -->
<inherits name="com.google.gwt.http.HTTP" />
<!-- For Logging Framework src: https://developers.google.com/web-toolkit/doc/latest/DevGuideLogging -->
<inherits name="com.google.gwt.logging.Logging" />
<set-property name="gwt.logging.enabled" value="FALSE" />
<define-configuration-property name="gin.ginjector"
is-multi-valued="false" />
<set-configuration-property name='gin.ginjector'
value='com.template.core.client.ioc.ClientGinjector' />
<!-- gwt dnd -->
<inherits name='com.allen_sauer.gwt.dnd.gwt-dnd'/>
桌面模塊[包含具有桌面特定視圖的桌面模塊]帶有入口點的desktop.gwt.xml
desktop.gwt.xml
<?xml version="1.0" encoding="UTF-8"?>
<inherits name='com.template.core.template' />
<entry-point class='com.template.desktop.client.desktoptemplate' />
<source path='client' />
數位板模塊[包含具有數位板特定視圖的數位板模塊] tablet.gwt.xml和入口點
移動模塊[包含具有移動專用視圖的移動模塊]帶入口點的mobile.gwt.xml
台式機,平板電腦和移動設備取決於核心模塊。 我還繼承了設備模塊中的核心模塊,並提到了設備模塊中核心的依賴性
我可以在eclipse中使用google gwt插件單獨運行這些模塊。 但是,當我在根項目上執行Maven安裝時,找不到核心模塊的入口點並拋出異常。
[錯誤]找不到類型'com.template.core.client.template'[INFO] [錯誤]提示:檢查類型名稱'com.template.core.client.template'的含義與您的實際含義相同[INFO] [錯誤]提示:檢查類路徑是否包含所有必需的源根。[信息] [錯誤]'file:/ home / software / mmt / template_ui / template_ui_desktop / src / main / java / com / template / desktop / client /中的錯誤desktoptemplate.java'[INFO] [ERROR]第20行:com.template.core.client.ioc.ClientGinjector類型沒有源代碼。 您忘了繼承必需的模塊嗎? [INFO] [ERROR]第21行:com.template.core.client.application.main.ServletURL類型沒有源代碼; 您忘了繼承必需的模塊嗎? [INFO] [ERROR]找不到類型'com.template.desktop.client.desktoptemplate'[INFO] [ERROR]提示:以前的編譯器錯誤可能使這種類型不可用[INFO] [ERROR]提示:檢查繼承鏈從您的模塊; 它可能未繼承所需的模塊,或者模塊未正確添加其源路徑條目
[INFO]模板用戶界面........................................... .................................成功[1.374 s] [INFO]核心模塊................ ................................................... ...................成功[46.110 s] [INFO]桌面模塊.................. ................................................... ........... FAILURE [23.713 s] [INFO]數位板模塊...................................... .......................................................... ....................... SKIPPED [INFO]移動模塊..................... ................................................... .............................跳過
解
一個gwt庫應該同時具有.java和.class文件。 這樣我們就需要打包兩個文件(也可以包含.css,.png,.html等文件)。 您可以使用下面的pom.xml配置將它們包括在內。
<outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.ui.xml</include>
<include>**/*.java</include>
<include>**/*.gwt.xml</include>
<include>**/*.html</include>
<include>**/*.js</include>
<include>**/*.css</include>
<include>**/*.gif</include>
<include>**/*.jpg</include>
<include>**/*.png</include>
</includes>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.ui.xml</include>
<include>**/*.java</include>
<include>**/*.gwt.xml</include>
<include>**/*.html</include>
<include>**/*.js</include>
<include>**/*.css</include>
<include>**/*.gif</include>
<include>**/*.jpg</include>
<include>**/*.png</include>
</includes>
</resource>
</resources>
<testResources>
<testResource>
<directory>src/test/resources</directory>
</testResource>
</testResources>
我已經在核心的pom.xml中使用了此配置
一個gwt庫應該同時具有.java和.class文件。 這樣我們就需要打包兩個文件(也可以包含.css,.png,.html等文件)。 您可以使用下面的pom.xml配置將它們包括在內。
<outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.ui.xml</include>
<include>**/*.java</include>
<include>**/*.gwt.xml</include>
<include>**/*.html</include>
<include>**/*.js</include>
<include>**/*.css</include>
<include>**/*.gif</include>
<include>**/*.jpg</include>
<include>**/*.png</include>
</includes>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.ui.xml</include>
<include>**/*.java</include>
<include>**/*.gwt.xml</include>
<include>**/*.html</include>
<include>**/*.js</include>
<include>**/*.css</include>
<include>**/*.gif</include>
<include>**/*.jpg</include>
<include>**/*.png</include>
</includes>
</resource>
</resources>
<testResources>
<testResource>
<directory>src/test/resources</directory>
</testResource>
</testResources>
我已經在核心的pom.xml中使用了此配置
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.