如何在GWT中包含自定义类

时间:2015-04-14 14:13:25

标签: maven gwt

我正在尝试将自己的包包含在GWT包中。如果我尝试在GWT应用程序中使用我自己的自定义包/类中的Java类,则会收到错误"该类型没有可用的源代码。在使用maven构建时,您是否忘记继承所需的模块"

我尝试了以下解决方案来解决上述问题:

  1. 我在gwt.xml
  2. 中继承了自定义程序包
  3. 我将自定义程序包包含在maven
  4. 的GWT应用程序的pom.xml
  5. 在存储库
  6. 中安装了jar

    但我仍然遇到上述错误。

    注意:我只是在命令行maven build期间才在eclipse中收到此错误。

    如何使用maven在GWT包中包含我自己的包?

    wmc.gwt.xml

    ?xml version="1.0" encoding="UTF-8"?>
    <module rename-to='wmc'>
    
      <!-- 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.user.theme.standard.Standard'/> -->
      <!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
      <!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/>     -->
      <inherits name="com.smartgwtpro.SmartGwtProNoTheme" />
      <inherits name="com.smartgwtpro.tools.Tools" />
    
      <inherits name="com.smartgwt.SmartGwtNoTheme"/>    
      <inherits name="com.smartclient.theme.enterprise.Enterprise"/>
      <inherits name="com.smartclient.theme.enterprise.EnterpriseResources"/>
    
      <inherits name='com.extjs.gxt.ui.GXT'/>
      <inherits name='com.googlecode.gchart.GChart'/>
      <inherits name='pl.balon.gwt.diagrams.Diagrams'/>
      <inherits name='com.google.gwt.visualization.Visualization'/>
      <inherits name='com.allen_sauer.gwt.dnd.gwt-dnd'/>
    
       <!-- inherit the customized package for accessing the method of that bundle -->
      <inherits name='com.bf.service.management'/>
    
      <!-- Specify the app entry point class.                         -->
      <entry-point class='com.isoft.web.viaductWebConsole.client.MonitorConsole'/>
    
      <!-- Specify the paths for translatable code                    -->
      <source path='wmc/client'/>
      <source path='wmc'/>
      <source path='web'/>
    

    上面提到的是gwt.xml,你可以找到<inherits name='com.bf.service.management'/> - 这是我需要在GWT应用程序中使用的自定义包,但是当我尝试构建GWT代码时,我是得到&#34;无法执行目标org.codehaus.mojo:gwt-maven-plugin:2.5.1:在项目wmc上编译:在项目源或资源中找不到GWT模块com.bf.service.management #34;

1 个答案:

答案 0 :(得分:1)

对我而言,只有在以下情况下才会发生:

  1. 您尚未在我的inherits文件中添加正确的project.gwt.xml声明。

  2. inherits语句的顺序错误。试着把它放在列表的上方。

  3. 只要您在inherits中拥有正确的pom.xml语句和正确的依赖项,它就应该有效。试着玩一下。

相关问题