In the code that I inherited my predecessors had decided to use a couple of
Spring classes even in GWT client code.
While I am not exactly enthused by this decision the referenced classes are
- at least from my point of view - OK to use in GWT client code, since they
are mostly interfaces or simple classes that don't pull too much of
"Spring" into the client. So my aim is to leave the code as such unchanged
as much as possible (trying to follow the "never change running
code"-principle...).
What I don't like, however, is that so far they had simply ignored the
resulting GWT compile errors. I am thus now trying to correct the GWT
settings such that this at least compiles without errors (i.e. that I can
use the "strict" compiler setting).
The initial error was that the Spring sources for GrantedAuthority,
CredentialsContainer and a few more classes could not be found during GWT
compilation.
When I then added the Spring sources jar to the dependencies the GWT
compiler ran havock and apparently tried to compile the ENTIRE Spring
library. That was definitely NOT what I wanted.
Next I tried to provide ONLY (copies of) those sources that are actually
referenced in our GWT code, i.e. I added copies of those spring source
files to our resources folder and try to direct the GWT compiler to use
only those. Besides the mentioned java files I thus also added a
GwtSpring.gwt.xml file which I reference from our application's
ZHStRegisterJPWeb.gwt.xml like so:
* <project_root>
|
+-* src
| +-* main
| | +-* java
| | | +-* ch
| | | | +-* zh
| | | | | +-* registerjp
| | | | | | +-* client
| | | | | | | +-- ...
| | | | | | +-* shared
| | | | | | | +-* security
| | | | | | | | +-- ZHStRegisterJPUser.java
| | | | | | | | +-- ...
| | | | | | | +-- ...
| | | | | | +-* server
| | | | | | | +-- ...
| | |
| | +-* resource
| | | +-* ch
| | | | +-* zh
| | | | | +-* registerjp
| | | | | | +-- ZHStRegisterJPWeb.gwt.xml << our application's gwt-file
| | | | | ...
| | | |
| | | +-* org
| | | | +-* springframework
| | | | | +-- GwtSpring.gwt.xml << the added Spring gwt-file
| | | | | +-* security << copies of the referenced Spring source files
below this folder
| | | | | | +-* core
| | | | | | | +-- GrantedAuthority.java
| | | | | | | +-- CredentialsContainer.java
| | | | | | | +-- ...
| | | | | | | +-* userdetails
| | | | | | | | +-- User.java
| | | | | | | | +-- UserDetails.java
| | | ...
[Note: '*' are directories]
The ZHStRegisterJPWeb.gwt.xml reads:
---
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='ZHStRegisterJPWeb'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />
<!-- used in ZHStRegisterJPUser and ZHStRegisterJPAuthority: -->
<inherits name="org.springframework.GwtSpring" />
... further details omitted here ...
---
The GwtSpring.gwt.xml reads:
---
<?xml version="1.0" encoding="UTF-8"?>
<module>
<source path="security.core">
<include name="GrantedAuthority.java" />
<include name="CredentialsContainer.java" />
</source>
<source path="security.core.userdetails">
<include name="User.java" />
<include name="UserDetails.java" />
</source>
... further details omitted here ...
</module>
---
However, the GWT compiler STILL complains that it can not locate the
sources of GrantedAuthority and other Spring classes:
...
[INFO] Tracing compile failure path for type
'ch.zh.ksta.zhstregisterjp.shared.security.ZHStRegisterJPUser'
[INFO] [ERROR] Errors in
'ch/zh/ksta/zhstregisterjp/shared/security/ZHStRegisterJPUser.java'
[INFO] [ERROR] Line 40: No source code is available for type
org.springframework.security.core.userdetails.User; did you forget to
inherit a required module?
[INFO] [ERROR] Line 94: No source code is available for type
org.springframework.security.core.GrantedAuthority; did you forget to
inherit a required module?
...
Any idea why it doesn't find these files even though I now provide them
explicitly? What am I missing here?
--
You received this message because you are subscribed to the Google Groups "GWT
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-web-toolkit/cffab879-e6ac-4aac-9fe1-cabcaac72d0an%40googlegroups.com.