Complie issue with Custom GWT project strcuture
I am working on a gwt module that is built using maven build system. I had a working module that had the following project structure.
project-name/src/main/开发者_开发技巧java/pkg1/pkg2/pkg3/EntryPoingClass
project-name/src/man/resources/pkg1/pkg2/ModuleDef.gwt.xml
The module definition was looking like this (I have put only this project specific settings here...normal inherits are not specified for the sake of brevity)
...
<entry-point class='pkg1.pkg2.pkg3.EntryPointClass'/> <source path='pkg3'/>...
I am not a big fan of having sub packages in the resources folder. Hence I am trying to change it to something like the following
project-name/src/main/java/pkg1/pkg2/pkg3/EntryPoingClass
project-name/src/man/resources/ModuleDef.gwt.xml
Also changed the module definition to
...
<entry-point class='pkg1.pkg2.pkg3.EntryPointClass'/> <source path='pkg1.pkg2.pkg3'/> <!-- Since the module def is not inside any package I am specifying the entire 'client' package here --> ...
After this, invoking gwt compile fails with the following error
Unable to find type "pkg1.pkg2.pkg3.EntryPointClass"
Can anybody tell me if there is any relation between the package structure of the EntryPointClass and the module definition package structure apart from the fact that the EntryPointClass should be inside the 'client' package specified in the module definition (which is satisfied here)?
Btw, I could see that the compiled classes are available in the classpath when invoking the gwt compiler.
Any help in this regard is greatly appreciated.
GWT compiler needs sources of client side classes, not only compiled bytecode. Is it in classpath?
In my company we always set pom.xml to copy sources to target as resources:
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/client/**/*.java</include>
<include>**/*.gwt.xml</include>
</includes>
</resource>
</resources>
</build>
Change **/client/**/*.java
to anything satisfies your needs (probably pkg1/pkg2/pkg3/**/*.java
). This way sources of client part are always in classpath.
精彩评论