我使用GWT 2.9.0 + GXT 4.1.0 + Java 11组合。我得到了误差以下的值[ERROR]提示:您的源代码似乎不在名为'client'的子包下面;没问题,但是你需要在你的模块中使用这个指令来使它可访问ProjectName。下面是我在eclipse中的package explorer中的项目结构。当我试图通过eclipse IDE中的gwt eclipse插件在超级开发模式下运行应用程序时,我得到了错误。你能帮我解决这个问题吗?
MavenProjectName
src/main/java——比;这是空的
src/main/src-client
com.cname.proj
Main.java
Main.gwt.xml
com.cname.proj.client.centerpanelscreens
com.cname.proj.client.command
com.cname.proj.service
src/main/src-common
com.cname.proj
Common.gwt.xml
com.cname.proj.model
com.cname.proj.model.to
com.cname.proj.service
com.cname.proj.util
src/main/webapp
index.html
src/main/webapp/web - inf
web.xml
Content below in Main.gwt.xml
<module rename-to="js">
<inherits name='com.google.gwt.user.User'/>
<inherits name='com.google.gwt.user.theme.clean.Clean'/>
<inherits name='com.cname.proj.Common' />
<inherits name='com.sencha.gxt.ui.GXT'/>
<entry-point class='com.cname.proj.Main' />
<source path="client" />
<source path="service"/>
</module>
Content below in Common.gwt.xml
<module>
<inherits name='com.sencha.gxt.ui.GXT'/>
<source path="model"/>
<source path="service" />
<source path="util">
</source>
GWT的日志
Resolving javax.validation.constraints.Pattern
Resolving javax.validation.constraints.Pattern.Flag
Found type 'javax.validation.constraints.Pattern.Flag'
Resolving method <clinit>
Resolving method <init>
Resolving method getValue
Resolving method values
Resolving method valueOf
Resolving field UNIX_LINES
Resolving field CASE_INSENSITIVE
Resolving field COMMENTS
Resolving field MULTILINE
Resolving field DOTALL
Resolving field UNICODE_CASE
Resolving field CANON_EQ
Resolving field value
Resolving javax.validation.constraints.Pattern.List
Found type 'javax.validation.constraints.Pattern.List'
Resolving annotation for java.lang.annotation.Target
Resolving annotation for java.lang.annotation.Retention
Resolving annotation for java.lang.annotation.Documented
Resolving method value
Resolving javax.validation.spi.ConfigurationState
Finding entry point classes
Tracing compile failure path for type 'com.cname.proj.Main'
Checked 0 dependencies for errors.
[ERROR] Hint: Your source appears not to live underneath a subpackage called 'client'; no problem, but you'll need to use the <source> directive in your module to make it accessible
Closing cache file: C:gwt-unitCachegwt-unitCache-b9eb8fcc22822eac5087fcda1c6dcb20c0796e62-18CAE75E829AF224BF18DEE97AC379EF-00000181BAD760BD (0 units written)
Deleting empty file: C:gwt-unitCachegwt-unitCache-b9eb8fcc22822eac5087fcda1c6dcb20c0796e62-18CAE75E829AF224BF18DEE97AC379EF-00000181BAD760BD
Shutting down PersistentUnitCache thread
Shutting down PersistentUnitCache thread
带有所需遗留插件的POM.xml
<plugins>
<!-- GWT Maven Plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.9.0</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test</goal>
<!-- goal>generateAsync</goal> -->
</goals>
</execution>
</executions>
<!-- Plugin configuration. There are many available options, see gwt-maven-plugin
documentation at codehaus.org -->
<configuration>
<!-- module>com.msci.dm.gis.gwt.Main</module-->
<runTarget>Main.html</runTarget>
<debugPort>8998</debugPort>
<hostedWebapp>${webappDirectory}</hostedWebapp>
<extraJvmArgs>-Xmx512M -Xss1024k</extraJvmArgs>
</configuration>`enter code here`
</plugin>
Tracing compile failure path for type 'com.cname.proj.Main' Checked 0 dependencies for errors. [ERROR] Hint: Your source appears not to live underneath a subpackage called 'client'; no problem, but you'll need to use the <source> directive in your module to make it accessible
你的。gwt.xml文件都位于/cname/project/目录下,并且只列出这些子包作为源代码:
<source path="client" /> <source path="service" /> ... <source path="model" /> <source path="service" /> <source path="util" />
(注意你有"服务"列出两次,两个.gwt.xml文件都声称服务器包是其自己模块的一部分)。
由于没有模块声明com.cname.proj的顶级包,该源文件在编译时将不可用。
期望的模式是只列出编译器期望将其所有内容转换为JS的包。通常,这是client
子包,但惯例通常表明也可能存在shared
子包,由服务器和客户端之间共享的代码组成。列出其他如service
,model
,util
没有问题,技术上也可以只列出空字符串来指示整个当前包和所有子包:
<source path="" />
说了这么多,最好的选择是将Main
移到com.cname.proj.client
中,因为它几乎肯定是一个专门的客户端类。