gwtgxt

Your src appears not to live underneath a subpackage called 'client',but you'll need to use the <src> directive in your module to make it accessible


I am using GWT 2.9.0 + GXT 4.1.0 + Java 11 combination. I am getting below error [ERROR] Hint: Your source appears not to live underneath a subpackage called 'client'; no problem, but you'll need to use the directive in your module to make it accessible ProjectName. Below is my project structure in package explorer in eclipse. I am getting the error when trying to run my application in super dev mode through gwt eclipse plugin in eclipse IDE. Can you help me in resolving the issue

MavenProjectName

src/main/java ----> This is empty

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 Logs

 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-unitCache\gwt-unitCache-b9eb8fcc22822eac5087fcda1c6dcb20c0796e62-18CAE75E829AF224BF18DEE97AC379EF-00000181BAD760BD (0 units written)
Deleting empty file: C:\gwt-unitCache\gwt-unitCache-b9eb8fcc22822eac5087fcda1c6dcb20c0796e62-18CAE75E829AF224BF18DEE97AC379EF-00000181BAD760BD
Shutting down PersistentUnitCache thread
Shutting down PersistentUnitCache thread

POM.xml with the required legacy plugin

<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>

Solution

  • 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
    

    Your .gwt.xml files both live in com/cname/proj/, and only lists these sub-packages as sources:

    <source path="client" />
    <source path="service" />
    ...
    <source path="model" />
    <source path="service" />
    <source path="util" />
    

    (note that you have "service" listed twice, both .gwt.xml files claim that the server package is part of its own module).

    Since no module is claiming the top-level package of com.cname.proj, that source file will not be available at compile time.


    The expected pattern is to only list packages that are expected for the compiler to transform all of their contents into JS. Typically, this is the client sub-package, but convention often suggests that a shared sub-package may exist too, consisting of code shared between the server and client. There is no problem with listing others like service, model, util, and you technically can also just list the empty string to indicate the entire current package and all subpackages:

    <source path="" />
    

    With all of that said, the best option is to move Main into com.cname.proj.client, since it is almost certainly exclusively a client class.