我在导入使用 org.codehaus.mojo GWT 插件创建的 GWT 库时遇到问题。项目类编译良好,当我在同一项目中创建入口点时工作正常。但是,当我将项目编译为.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
以下是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>
这里也是模块描述符:
<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>
我错过了什么吗?
创建 jar 时,您需要确保 src 包含在 jar 中,或者提供单独的 src jar 并在编译时需要 src jar。
GWT 需要编译时依赖项的类文件和源文件。