Add external java project to GWT project in Eclipse

152 views
Skip to first unread message

martinhansen

unread,
Jul 20, 2009, 11:44:38 AM7/20/09
to Google Web Toolkit
Hello,

my GWT server-side code needs an external java project. I have added
the project under "Configure build path / Projects". It works fine in
hosted mode. But when I deploy my application on a server, I get lots
of ClassNotFoundExceptions. Obviously, GWT cannot find the external
java code. When I look at the war\WEB-INF\classes folder, I see that
the external java classes have not been included.

How can I get GWT to include the external classes?

Sean

unread,
Jul 20, 2009, 12:03:54 PM7/20/09
to Google Web Toolkit
You can export the non-GWT java files into a jar and drop those in the
WEB-INF/lib folder. That's what I do.

On Jul 20, 11:44 am, martinhansen <martin.hanse...@googlemail.com>
wrote:

martinhansen

unread,
Jul 20, 2009, 12:14:18 PM7/20/09
to Google Web Toolkit
Hello Sean,

thank you very much. I've thought of that solution too, but it is not
appropriate for my GWT project. I have to add 4 external projects to
my GWT project, and all of these 4 projects are subject to change
every day. It would be too much work to export them to a jar file
every day. Is there some way to automatically add the external project
sources to the GWT output folder?

Jason Parekh

unread,
Jul 20, 2009, 2:34:05 PM7/20/09
to Google-We...@googlegroups.com
Hi Martin,

You may try using the link source option, as suggested by the thread at
http://groups.google.com/group/google-appengine-java/browse_thread/thread/1908b3bedf954b75/ca0370ae3ae5a394?lnk=raot.  If that doesn't work, you could set the output directory of your dependencies to be the GWT output folder.

jason

martinhansen

unread,
Jul 20, 2009, 4:16:48 PM7/20/09
to Google Web Toolkit
Hello Jason,

thanks for your interesting hints. I tried the Google App Engine
first, but to no avail. I tried to convert my project to use the
Google App Engine, but then I got some errors referring to missing XML
files.
The second approach sounds also interesting, but I need a little hint
there. Where exactly do I have to set the output folder to?

Let's say, I have two Projects:

GwtApp
--src
----com.company.gwtapp
------GwtApp.java


DataProject
--src
----com.company.data
------Employee.java


And I want Employee.java to be available in my Gwt App, what do I have
to do? In Eclipse, "Configure build path" on DataProject, then
"source", then change "default output folder"? If so, to what value
should I change it to?



On 20 Jul., 20:34, Jason Parekh <jasonpar...@gmail.com> wrote:
> Hi Martin,
> You may try using the link source option, as suggested by the thread athttp://groups.google.com/group/google-appengine-java/browse_thread/th....
>  If that doesn't work, you could set the output directory of your
> dependencies to be the GWT output folder.
>
> jason
>
> On Mon, Jul 20, 2009 at 12:14 PM, martinhansen <
>

Donald W. Long

unread,
Jul 20, 2009, 4:21:55 PM7/20/09
to Google Web Toolkit
I looked at the linked source method and you have to have the linked
source fully qualified. Thats nice if you always have your source in
the same place. You could try using the linked variables but then
thats also work. Do not see this as a real option for projects that
will be worked on by many developers at the same time.

If I am wrong please let me know.

Thanks

Donald W. Long (donald...@thelongsfamily.com)


On Jul 20, 1:34 pm, Jason Parekh <jasonpar...@gmail.com> wrote:
> Hi Martin,
> You may try using the link source option, as suggested by the thread athttp://groups.google.com/group/google-appengine-java/browse_thread/th....
>  If that doesn't work, you could set the output directory of your
> dependencies to be the GWT output folder.
>
> jason
>
> On Mon, Jul 20, 2009 at 12:14 PM, martinhansen <
>
>
>
> martin.hanse...@googlemail.com> wrote:
>
> > Hello Sean,
>
> > thank you very much. I've thought of that solution too, but it is not
> > appropriate for my GWT project. I have to add 4 external projects to
> > my GWT project, and all of these 4 projects are subject to change
> > every day. It would be too much work to export them to a jar file
> > every day. Is there some way to automatically add the external project
> > sources to the GWT output folder?
>
> > On 20 Jul., 18:03, Sean <slough...@gmail.com> wrote:
> > > You can export the non-GWT java files into a jar and drop those in the
> > > WEB-INF/lib folder. That's what I do.
>
> > > On Jul 20, 11:44 am, martinhansen <martin.hanse...@googlemail.com>
> > > wrote:
>
> > > > Hello,
>
> > > > my GWT server-side code needs an external java project. I have added
> > > > the project under "Configure build path / Projects". It works fine in
> > > > hosted mode. But when I deploy my application on a server, I get lots
> > > > of ClassNotFoundExceptions. Obviously, GWT cannot find the external
> > > > java code. When I look at the war\WEB-INF\classes folder, I see that
> > > > the external java classes have not been included.
>
> > > > How can I get GWT to include the external classes?- Hide quoted text -
>
> - Show quoted text -
Message has been deleted

martinhansen

unread,
Jul 20, 2009, 4:29:05 PM7/20/09
to Google Web Toolkit
Hello Donald,

I already tried the Google App Engine approach, but it didn't work for
me. And GAE adds a lot of stuff I don't need to my project. I really
don't want to mess around with it, since I managed to kill my GWT
app's configuration several times and I had to create a new project.

Meanwhile, I tried the "output folder" approach. I tried to change the
default output folder of "DataProject", but I
didn't manage successfully. Eclipse says: Path '/GwtApp/src' must
denote location inside project 'DataProject'. Am I heading the wrong
way there?

On 20 Jul., 22:21, "Donald W. Long" <donald.w.l...@gmail.com> wrote:
> I looked at the linked source method and you have to have the linked
> source fully qualified.  Thats nice if you always have your source in
> the same place.  You could try using the linked variables but then
> thats also work.  Do not see this as a real option for projects that
> will be worked on by many developers at the same time.
>
> If I am wrong please let me know.
>
> Thanks
>
> Donald W. Long (donald.w.l...@thelongsfamily.com)

martinhansen

unread,
Jul 20, 2009, 4:35:34 PM7/20/09
to Google Web Toolkit
Now I tried the "link source" function without Google App Engine. At
first, it seems to work, and the project is added to my main project.
The only problem is: The package declarations produce errors. Eclipse
shows an error message:

The declared package "com.company.data" does not match the expected
package "src.com.company.data"

What to do?


On 20 Jul., 22:29, martinhansen <martin.hanse...@googlemail.com>
wrote:

Jason Parekh

unread,
Jul 20, 2009, 5:43:35 PM7/20/09
to Google-We...@googlegroups.com
Hi Martin,

For the "Linked folder location," ensure you have the trailing "src" included.

jason

martinhansen

unread,
Jul 21, 2009, 6:16:11 AM7/21/09
to Google Web Toolkit
Hello Jason,

that did the trick! Thank you very much, it works fine now. Great!


On 20 Jul., 23:43, Jason Parekh <jasonpar...@gmail.com> wrote:
> Hi Martin,
> For the "Linked folder location," ensure you have the trailing "src"
> included.
>
> jason
>
> On Mon, Jul 20, 2009 at 4:35 PM, martinhansen <
>

branflake2267

unread,
Jul 29, 2009, 12:34:22 AM7/29/09
to Google Web Toolkit
Hi Martin,

On including more than one project source into your gwt project, can
you tell me what you did to get two projects to work together in GWT.
I have been trying over and over to combine two projects up for some
time, and have not been able to do it.

Thanks,
Brandon

On Jul 21, 3:16 am, martinhansen <martin.hanse...@googlemail.com>
wrote:
> > > > > > > my GWT project, and all of these 4projectsare subject to change
> > > > > > > every day. It would be too much work to export them to a jar file
> > > > > > > every day. Is there some way to automatically add the external
> > > project
> > > > > > > sources to the GWT output folder?
>
> > > > > > > On 20 Jul., 18:03, Sean <slough...@gmail.com> wrote:
> > > > > > > > You can export the non-GWT java files into a jar and drop those
> > > in the
> > > > > > > > WEB-INF/lib folder. That's what I do.
>
> > > > > > > > On Jul 20, 11:44 am, martinhansen <
> > > martin.hanse...@googlemail.com>
> > > > > > > > wrote:
>
> > > > > > > > > Hello,
>
> > > > > > > > > my GWT server-side code needs an external java project. I have
> > > added
> > > > > > > > > the project under "Configure build path /Projects". It works

martinhansen

unread,
Jul 29, 2009, 4:53:26 PM7/29/09
to Google Web Toolkit
Hello Brandon,

I used the "link source" function in eclipse. I added all the projects
this way. What exactly is your problem? Do you get any error message?
What did you do to add the projects?
Reply all
Reply to author
Forward
0 new messages