you need to add the .jar into your ant's build classpath (in addition
to putting it into the WEB-INF/lib if you want the classes to be
accessible to your server-side runtime servlets).
the GWT compiler needs access to the source code (you actually only
need the .class files if (a) you are using an IDE such as Eclipse and
want to have access to stuff like code-completion or (b) your server-
side Java uses those classes.)
As an aside, also note the 'renameTo' (i think, you can look it up)
attribute of the <module> tag, to avoid the awkwardness of having to
specify the full qualified package name when importing / using.
I am about to write in greater detail about this on my blog (http://
codetrips.blogspot.com) but essentially:
1) module is in com/alertavert/gwt/GridBased.gwt.xml
<module>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User'/>
<inherits name='com.google.gwt.user.theme.standard.Standard'/>
<stylesheet src="gridbased.css"/>
<!-- There is no EntryPoint defined here, as this is inherited by
external apps that will provide their own entry point.
To run the demo app, use GridBasedDemo.gwt.xml
-->
</module>
2) code is in com.alertavert.gwt.client.*
(but in your case, using <source> you correctly make it point
to .account)
3) code wanting to use those 'libraries' use the following (in com/
alertavert/gwt/demo/Demo_grid_based.gwt.xml):
<module>
//... other stuff
<!-- Other module inherits -->
<inherits name='com.alertavert.gwt.GridBased' />
<!-- Specify the app entry point class. -->
<entry-point class='com.alertavert.gwt.demo.client.Demo_grid_based'/
>
<!-- Specify the paths for translatable code -->
<source path='client'/>
</module>
I use Eclipse, so the GridBased.jar must be added to the source
classpath in its build config (using ant, you'll have to add it to the
classpath= attribute; been a while since I used ant, so you may want
to double-check).
HTH, cheers
Marco.
On Jan 23, 5:50 pm, brt56 <[email protected]> wrote:
> All
>
> I have some classes in my jar file with the following structure
>
> com.test.app.account.Account.java
>
> I have included the java and class files into the jar. And I have
> created a module gwt xml file at the top in
>
> com.test.app called TestAppModule.gwt.xml that looks like this
>
> <?xml version="1.0" encoding="UTF-8"?>
> <module>
> <inherits name='com.google.gwt.user.User'/>
> <source path="account"/>
> </module>
>
> I compile this jar using ant and then copy it into my GWT project
> under war/WEB-INF/lib and make sure that the
> ant build file in this project has the jar in its compile classpath.
>
> I then change my GWT Project XML entry point class to
>
> <module rename-to='gwttestweb'>
> <!-- Inherit the core Web Toolkit stuff. -->
> <inherits name='com.google.gwt.user.User'/>
> <inherits name='com.test.app.TestAppModule'/>
> <entry-point class='com.test.app.GWTTestWeb'/>
> </module>
>
> But when I run an ant compile on this project i get
>
> gwtc:
> [java] Compiling module com.test.app.GWTTestWeb
> [java] Validating newly compiled units
> [java] [ERROR] Errors in 'file:/test/eclipse/gwttestweb/src/
> com/test/app/TestService.java'
> [java] [ERROR] Line 19: No source code is available for
> type com.test.app.account.Account; did you forget to inherit a
> required module?
>
> Have I missed something?
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.