我在导入使用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>
我错过了什么吗?
答案 0 :(得分:1)
创建jar时,您需要确保src包含在jar中,或者您提供单独的src jar并在编译时需要src jar。
GWT需要类和源文件以实现编译时依赖性。