[英]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.