Home » Newcomers » Newcomers » package hierarchy
package hierarchy [message #134903] |
Fri, 03 February 2006 17:44  |
Eclipse User |
|
|
|
Originally posted by: mboerger.decommunications.com
I have a fairly large (about 900 custom classes) java web application
running on Tomcat which I'm trying to import into Eclipse.
The packages and their source files are named and stored hierarchically
according to what I thought was standard java style:
'com.company.project.packagename'.
(stored in WEB_INF/com/company/project/packagename/)
Additionaly, some packages are nested, i.e
'com.dande.project.packagename.extendedpackagename'
This works well with both javac and tomcat -- without any special
configuration, but when I import the project into Eclipse, it seems unable
to recognize the packages in a hierarchy. (It appears to expect all
package directories to sit directly in WEB-INF/src/)
I expect I can fix this through the buildpath, but it has proven harder
than expected.
Can packages be stored in hierarchical file structures in eclipse? And, if
so, can you recommend a good tutorial that deals with this?
|
|
|
Re: package hierarchy [message #135529 is a reply to message #134903] |
Mon, 06 February 2006 15:12   |
Eclipse User |
|
|
|
Originally posted by: mboerger.decommunications.com
Matt wrote:
> I have a fairly large (about 900 custom classes) java web application
> running on Tomcat which I'm trying to import into Eclipse.
> The packages and their source files are named and stored hierarchically
> according to what I thought was standard java style:
> 'com.company.project.packagename'. (stored in
> WEB_INF/com/company/project/packagename/)
> Additionaly, some packages are nested, i.e
> 'com.dande.project.packagename.extendedpackagename'
>
> This works well with both javac and tomcat -- without any special
> configuration, but when I import the project into Eclipse, it seems
> unable to recognize the packages in a hierarchy. (It appears to expect
> all package directories to sit directly in WEB-INF/src/)
>
> I expect I can fix this through the buildpath, but it has proven harder
> than expected.
> Can packages be stored in hierarchical file structures in eclipse? And,
> if so, can you recommend a good tutorial that deals with this?
>
>
ok -- I was able to figure out how to import all of my classes into a
New Java Project. For anyone else encountering this problem, the Help
document 'Java Development User Guide -> Getting Started -> Project
Configuration Tutorial -> Detecting existing layout' is very helpful at
accomplishing this.
Following these steps, Eclipse handles all of the build path steps and
exclusions on its own.
The remaining problem for me now is that my project really is a dynamic
Web Application, not a Java Project. The File-> New-> New Project
->Dynamic Web Application wizard doesn't offer the same steps for
importing source files.
Is it possible/advisable to convert a Java Project to a Dynamic Web App,
or is there another possible process (maybe, import my JSPs, HTML, CSS,
etc into a Dynamic Web App, and import the Java Project into that
project as external resources)?
I'm sure I can figure out how to make this work, but I'm looking for
insights that point toward the solution that will be most manageable
from the standpoint of regularly deploying the entire project (java +
web) to a production server as a single WAR file.
|
|
|
Re: package hierarchy [message #135581 is a reply to message #135529] |
Mon, 06 February 2006 17:17   |
Eclipse User |
|
|
|
Originally posted by: ns_dkerber.ns_WarrenRogersAssociates.com
In article <ds8ajm$p27$1@utils.eclipse.org>,
mboerger@decommunications.com says...
....
> The remaining problem for me now is that my project really is a dynamic
> Web Application, not a Java Project. The File-> New-> New Project
> ->Dynamic Web Application wizard doesn't offer the same steps for
> importing source files.
>
> Is it possible/advisable to convert a Java Project to a Dynamic Web App,
> or is there another possible process (maybe, import my JSPs, HTML, CSS,
> etc into a Dynamic Web App, and import the Java Project into that
> project as external resources)?
>
> I'm sure I can figure out how to make this work, but I'm looking for
> insights that point toward the solution that will be most manageable
> from the standpoint of regularly deploying the entire project (java +
> web) to a production server as a single WAR file.
What I do is have the standard java project and the dynamic web project
both listed in Eclipse, and have the dynamic one list the standard one
as a required project on the build path in the project properties.
There are about 3 different places this has to be set, but it does work
once you find them all. When you generate the .war file, you can choose
to have the .jar placed within the .war, or you can deploy it separately
(which is what I do).
--
Remove the ns_ from if replying by e-mail (but keep posts in the
newsgroups if possible).
|
|
|
Re: package hierarchy [message #135792 is a reply to message #135581] |
Tue, 07 February 2006 09:43  |
Eclipse User |
|
|
|
Originally posted by: mboerger.decommunications.com
David Kerber wrote:
> In article <ds8ajm$p27$1@utils.eclipse.org>,
> mboerger@decommunications.com says...
>
> ...
>
>> The remaining problem for me now is that my project really is a dynamic
>> Web Application, not a Java Project. The File-> New-> New Project
>> ->Dynamic Web Application wizard doesn't offer the same steps for
>> importing source files.
>>
>> Is it possible/advisable to convert a Java Project to a Dynamic Web App,
>> or is there another possible process (maybe, import my JSPs, HTML, CSS,
>> etc into a Dynamic Web App, and import the Java Project into that
>> project as external resources)?
>>
>> I'm sure I can figure out how to make this work, but I'm looking for
>> insights that point toward the solution that will be most manageable
>> from the standpoint of regularly deploying the entire project (java +
>> web) to a production server as a single WAR file.
>
> What I do is have the standard java project and the dynamic web project
> both listed in Eclipse, and have the dynamic one list the standard one
> as a required project on the build path in the project properties.
> There are about 3 different places this has to be set, but it does work
> once you find them all. When you generate the .war file, you can choose
> to have the .jar placed within the .war, or you can deploy it separately
> (which is what I do).
>
Thanks for your response David,
I think I will try to re-organize my project to try out your process. In
the mean time, for anyone else encountering the problems I was, I was
able to get my classes/packages recognized in their current
configuration, using the New -> Project -> Web -> Dynamic Web Project
wizard with my current project Context Root directory as the content
directory.
I had tried this before, but had gotten an error saying there was
already a project in the directory. The error message says that your
options for this are to choose a new directory, or to wipe out the
current contents of the directory, but it turned out that the only file
which was really causing a conflict were old (hidden) .project and
..classpath files from an earlier attempt. Once I deleted those files the
project built with no problems.
|
|
|
Goto Forum:
Current Time: Wed May 07 02:56:04 EDT 2025
Powered by FUDForum. Page generated in 0.11972 seconds
|