Hi, Isaac and Rajeev and everyone else ...

I got a good result by following this advice, though with a few bumps.
I'm posting a (hopefully) good accounting here so that this post can
be helpful to others.

As originally described, I was trying to create a project that
contains common constants in a .java file. I expected other projects
to "import static ..." to get to the constants.

To do this, I created a GWT project and then adjusted it. I added a
<source> directive to the Definitions.gwt.xml file, and I removed
unneeded client, server, and Public directories. As a result, my
Definitions project directory and the referencing project looks as
show below.

PALMS_Definitions
   +bin
   +src
       +org
           +paceproject
               +palms
                   +definitions
                       +schema
                            ClassDefinitions.java
                        Definitions.gwt.xml
    .classpath
    .project

The ClassDefinitions.java file contains the common constants.

The Definitions.gwt.xml file contains:
    <module>
            <inherits name="com.google.gwt.user.User"/>
            <source path="schema"/>
    </module>

I assume that the gwt-user.jar is already available to the project via
the .classpath file.

For completeness, my .classpath file has:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
        <classpathentry kind="src" path="src"/>
        <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
        <classpathentry kind="var" path="GWT_HOME/gwt-user.jar"/>
        <classpathentry kind="output" path="bin"/>
</classpath>

My .project file has:
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
        <name>PALMS_Definitions</name>
        <comment></comment>
        <projects>
        </projects>
        <buildSpec>
                <buildCommand>
                        <name>com.swtdesigner.gwt.GWTBuilder</name>
                        <arguments>
                        </arguments>
                </buildCommand>
                <buildCommand>
                        <name>org.eclipse.jdt.core.javabuilder</name>
                        <arguments>
                        </arguments>
                </buildCommand>
        </buildSpec>
        <natures>
                <nature>org.eclipse.jdt.core.javanature</nature>
                <nature>com.swtdesigner.gwt.GWTNature</nature>
        </natures>
</projectDescription>

As for the project that references this project, the Projects tab in
the Build Path dialog most have PALMS_Definitions added in.

Once all of this is true (and, maybe, the projects are all rebuilt),
there should be no more source errors deriving from the GWT
compilation.


On Jun 7, 11:52 am, Rajeev Dayal <rda...@google.com> wrote:
> Hi Barry,
> Issac is correct. Please try out his approach, and post back on this thread
> if you have any other questions or problems.
>
> Rajeev
>
> On Fri, Jun 5, 2009 at 5:03 PM, Isaac Truett <itru...@gmail.com> wrote:
> > Everything you use on the client has to be part of a GWT module. Just
> > create a module definition (*.gwt.xml) with <source> pointing to your
> > interfaces. Inherit that module in your app, and you're set.
>
> > On Tue, Jun 2, 2009 at 5:04 PM, Barry <bdemc...@gmail.com> wrote:
>
> >> Hi --
>
> >> I have seen a lot of posts referring to variants of this problem, but
> >> haven't seen a resolution to this specific situation ... and I'm
> >> afraid I'm not making headway. This seems very simple, but if I can't
> >> do it, please let me know.
>
> >> I'm running Eclipse 3.4.2 with GWT 1.5.2. I have a perfectly fine GWT
> >> project that I'd like to have reference constants defined in an
> >> Interface in another project (which itself contains only Interfaces).
> >> Eclipse seems fine with this, as long as I use Build Path to identify
> >> the external project in the Projects tab.
>
> >> GWT, though, gives the error
> >> "org.paceproject.palms.schema.XSDDefinitions can not be found in
> >> source packages. 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."
>
> >> From other posts, it seems like GWT is trying to tell me it's going to
> >> have trouble loading the external project at runtime.
>
> >> All I'm using this external project for is to provide definitions
> >> common to all of my applications (including my GWT application).
>
> >> Is there a particular way I should be defining my external project
> >> (i.e., the one that contains
> >> org.paceproject.palms.schema.XSDDefinitions)? Or is there something
> >> particular I should be doing to my GWT project's gwt.xml file??
>
> >> Or should I be trying to import symbols common to multiple projects in
> >> a completely different way??
>
> >> Thanks for any help/advice you can give me.
>
> >> (FYI, the offending import in my GWT project is import static
> >> org.paceproject.palms.schema.XSDDefinitions.*; and the Interface in
> >> the external project is
>
> >> package org.paceproject.palms.schema;
>
> >> public interface XSDDefinitions {
>
> >>        public static final String XSD_String = "xsd:string";
> >> }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to