简体   繁体   English

GWT:导入后“没有源代码可用于输入”

[英]GWT: “No source code is available for type” after import

I am having an issue importing a GWT libray that I have created using org.codehaus.mojo GWT plugin. 我在导入使用org.codehaus.mojo GWT插件创建的GWT libray时遇到问题。 The project classes compile fine, and work fine when I create an entry point within the same project. 项目类可以很好地编译,并且当我在同一项目中创建入口点时可以正常工作。 However, when I compile the project as a .jar, and try to import it into another project, I get: 但是,当我将项目编译为.jar并尝试将其导入另一个项目时,我得到:

    Tracing compile failure path for type 'com.test.client.test'
[INFO]          [ERROR] Errors in 'file:/C:/Users/zakaria/Desktop/myWork/GWidgets/workspace/testing/src/main/java/com/test/client/test.java'
[INFO]             [ERROR] Line 23: No source code is available for type com.gwidgets.leaflet.options.MapOptions; did you forget to inherit a required module?
[INFO]             [ERROR] Line 23: No source code is available for type com.gwidgets.leaflet.options.ZoomPanOptions; did you forget to inherit a required module?
[INFO]             [ERROR] Line 23: No source code is available for type com.gwidgets.leaflet.L; did you forget to inherit a required module?
[INFO]       [ERROR] 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

here is an extract of the pom.xml: 这是pom.xml的一部分:

  <build>
    <!-- Output classes directly into the webapp, so that IDEs and "mvn process-classes" update them in DevMode -->
    <outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>

    <plugins>

      <!-- Mojo's Maven Plugin for GWT -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>gwt-maven-plugin</artifactId>
        <version>2.8.0-beta1</version>
        <executions>
          <execution>
            <goals>
              <goal>compile</goal>
              <goal>test</goal>
              <goal>generateAsync</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <runTarget>GwtyLeaflet.html</runTarget>
          <modules>
            <module>com.gwidgets.GwtyLeaflet</module>
          </modules>
          <jsInteropMode>JS_RC</jsInteropMode>
        </configuration>
      </plugin>
    </plugins>
  </build>

Here is also the module the descriptor: 这也是模块的描述符:

 <module rename-to='GwtyLeaflet'>
   <inherits name='com.google.gwt.user.User' />
  <inherits name="com.google.gwt.core.Core"/>
   <inherits name='com.gwidgets.api.GwtyLeaflet' />

  <source path='leaflet'/>

</module>

Am I missing something? 我想念什么吗?

When creating your jar, you either need to make sure the src is included in the jar or that you provide a separate src jar and require the src jar at compile time. 创建jar时,您需要确保src包含在jar中,或者需要提供单独的src jar并在编译时需要src jar。

GWT requires both the class and source files for compile time dependencies. GWT同时需要类文件和源文件来编译时间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM