GWT - 无法找到类型“com.myapp.launcher.client.LauncherInitializer”多模块架构

发布于 2024-12-06 05:51:38 字数 3846 浏览 0 评论 0原文

我有一个具有以下结构的项目:

com.myapp.gwt:
    Basic.gwt.xml
    Launcher.gwt.xml - inherits Basic.gwt.xml
    Module1.gwt.xml - inherits Basic.gwt.xml
com.myapp.gwt.ui.basic.client:
    AppActivityMapper.java
    AppHistoryManager.java
    AppPlaceHistoryMapper.java
    BasicInitializer.java - this is a daddy class for all entry points
    MainClientFactory.java
    MainClientFactoryImpl.java
com.myapp.gwt.ui.launcher.client: - all the stuff for the launcher module is here
    LauncherInitializer.java (extends BasicInitializer, launcher module's EntryPoint)
com.myapp.gwt.ui.launcher.client.places:
    Places and activities for the launcher module
com.myapp.gwt.ui.module1.client: - all the stuff for the module1 module is here
    Module1Initializer.java (extends BasicInitializer, module1 module's EntryPoint)
com.myapp.gwt.ui.module1.client.places:
    Places and activities for the module1 module
com.myapp.gwt.shared:
    Stuff shared between the client and the server (interfaces, dtos)
com.myapp.gwt.server:
    Code that works only on the server

Basic.gwt.xml 中的内容是这样的:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.1.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.3.0/distro-source/core/src/gwt-module.dtd">
<module  rename-to='myapp'>
    <!-- Inherit the core Web Toolkit stuff. -->
    <inherits name='com.google.gwt.user.User' />

    <!-- 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.clean.Clean' />

    <inherits name="com.google.gwt.place.Place" />
    <inherits name="com.google.gwt.activity.Activity" />
    <inherits name="com.google.gwt.editor.Editor" />

    <!-- Specify the paths for translatable code -->
    <source path='ui.basic.client' />
    <source path='shared' />

    <replace-with class="com.myapp.gwt.ui.basic.client.ClientFactoryImpl">
        <when-type-is class="com.myapp.gwt.ui.basic.client.ClientFactory" />
    </replace-with>

<set-configuration-property name="UiBinder.useSafeHtmlTemplates" value="true" />
</module>

我的 Launcher.gwt.xml 中的内容是这样的:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.1.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.3.0/distro-source/core/src/gwt-module.dtd">
<module  rename-to='launcher'>

    <!-- Other module inherits -->
    <inherits name="com.myapp.gwt.Basic" />

    <!-- Specify the paths for translatable code -->
    <source path="ui.launcher.client"></source>

    <!-- Specify the app entry point class. -->
    <entry-point class='com.myapp.gwt.ui.launcher.client.LauncherInitializer' />

</module>

com.myapp.gwt.ui.basic.client 包中驻留的类都没有引用其他模块中的任何类包。另一方面,其他模块包有很多对基本模块的引用,有些类甚至扩展了基本包内的类。

问题是我在编译到 javascript 启动器模块期间遇到此错误:

[TRACE] [launcher] - Finding entry point classes
[ERROR] [launcher] - Unable to find type 'com.myapp.gwt.ui.launcher.client.LauncherInitializer'
[ERROR] [launcher] - Hint: Previous compiler errors may have made this type unavailable
[ERROR] [launcher] - Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly
[ERROR] [launcher] - Failed to load module 'launcher' from user agent 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0' at localhost:61253

另外,如果您发现我所做的事情值得更改,请告诉我。

I have a project with the following structure:

com.myapp.gwt:
    Basic.gwt.xml
    Launcher.gwt.xml - inherits Basic.gwt.xml
    Module1.gwt.xml - inherits Basic.gwt.xml
com.myapp.gwt.ui.basic.client:
    AppActivityMapper.java
    AppHistoryManager.java
    AppPlaceHistoryMapper.java
    BasicInitializer.java - this is a daddy class for all entry points
    MainClientFactory.java
    MainClientFactoryImpl.java
com.myapp.gwt.ui.launcher.client: - all the stuff for the launcher module is here
    LauncherInitializer.java (extends BasicInitializer, launcher module's EntryPoint)
com.myapp.gwt.ui.launcher.client.places:
    Places and activities for the launcher module
com.myapp.gwt.ui.module1.client: - all the stuff for the module1 module is here
    Module1Initializer.java (extends BasicInitializer, module1 module's EntryPoint)
com.myapp.gwt.ui.module1.client.places:
    Places and activities for the module1 module
com.myapp.gwt.shared:
    Stuff shared between the client and the server (interfaces, dtos)
com.myapp.gwt.server:
    Code that works only on the server

what i have in my Basic.gwt.xml is this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.1.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.3.0/distro-source/core/src/gwt-module.dtd">
<module  rename-to='myapp'>
    <!-- Inherit the core Web Toolkit stuff. -->
    <inherits name='com.google.gwt.user.User' />

    <!-- 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.clean.Clean' />

    <inherits name="com.google.gwt.place.Place" />
    <inherits name="com.google.gwt.activity.Activity" />
    <inherits name="com.google.gwt.editor.Editor" />

    <!-- Specify the paths for translatable code -->
    <source path='ui.basic.client' />
    <source path='shared' />

    <replace-with class="com.myapp.gwt.ui.basic.client.ClientFactoryImpl">
        <when-type-is class="com.myapp.gwt.ui.basic.client.ClientFactory" />
    </replace-with>

<set-configuration-property name="UiBinder.useSafeHtmlTemplates" value="true" />
</module>

what i have in my Launcher.gwt.xml is this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.1.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.3.0/distro-source/core/src/gwt-module.dtd">
<module  rename-to='launcher'>

    <!-- Other module inherits -->
    <inherits name="com.myapp.gwt.Basic" />

    <!-- Specify the paths for translatable code -->
    <source path="ui.launcher.client"></source>

    <!-- Specify the app entry point class. -->
    <entry-point class='com.myapp.gwt.ui.launcher.client.LauncherInitializer' />

</module>

None of my classes residing inside the com.myapp.gwt.ui.basic.client package have reference to any of the classes inside the other module packages. The other module packages on the other hand have lots of references to the basic module and some of the classes even extend the classes inside the basic package.

The problem is that i'm getting this error during compiling to javascript launcher module:

[TRACE] [launcher] - Finding entry point classes
[ERROR] [launcher] - Unable to find type 'com.myapp.gwt.ui.launcher.client.LauncherInitializer'
[ERROR] [launcher] - Hint: Previous compiler errors may have made this type unavailable
[ERROR] [launcher] - Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly
[ERROR] [launcher] - Failed to load module 'launcher' from user agent 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0' at localhost:61253

Also please tell me if you see something worth changing in the stuff i've done.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梓梦 2024-12-13 05:51:38

只是快速猜测:您尝试过吗:

Just a quick guess: did you try : <source path='ui/basic/client' />

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文