Netbeans File Organization - Web Project

L

LB

I'm confused by how Netbeans (ver. 6.1) projects manage files. I'm
working on a simple .jsp web application.

My project folder looks like this (I'm looking via Windows Explorer):
Website_Project
/build/
/build/web/ <---
/build/web/META-INF/
/build/web/WEB-INF/
....
/nbproject/
/nbproject/private/

/src/
/src/conf/
/src/java/
/src/java/package_name

/test/

/web/ <---
/web/WEB-INF/
/web/WEB-INF/wsdl

Its the two different /web/ folders that screwing me up. All of my
html and .jsp files are copied into those two directories, but they
never seem to have the same last modified date on them. It looks like
the build folder has more up to date files. Why are there two folders
that contain the same files? I don't get it. Is one directory a
backup for the other? I never can tell which copy of the file is
which. Its not really a problem if you are solely working in
Netbeans, projects, but if you are importing / copying or using other
development tools you can go absolutely crazy. Anybody know why the
system is generating these copies, and what is the logic behind their
non-intuitive update scheme?

How do you guys manage your projects, if you have to occasionally work
outside of netbeans? When you deploy to another server do you copy
the files from the /web/ folder or from the /build/web/ folder?

In my case, I'm using Netbeans to prove out the .jsp and java code and
logic, but for making a web page pretty, doing CSS work, and
validating html/xml code, Macromedia Dreamweaver is much easier to
use.

Anybody else been here before? Any tips or hints to the rookie? Many
thanks in advance.

--LB
Metro Detroit
 
L

LB

This is not NetBeans-specific. This is the standard layout for source and
deployment directories for a web application. Well, nbproject/ is
NB-specific, but the rest aren't.

Lew, thanks for the reply. I fully understand that there are two
directories, one for source and one for deployment, but what I don't
understand is the management behind them. My expectation is the
system always works off of the build folder, but when you "run" the
application, Netbeans would make a copy of the build folder files, and
update the files in the deployment directory, and then deploy off the
deployment directory... but my system is clearly is NOT working that
way. When I spot check the files in the deployment directory, they
are about two or three series of changes too old. (Netbeans does have
a pretty good file compare tool!) I don't understand the mechanism
where files in the deployment directory are updated with recent
changes. My take is that nothing in the deployment directory can be
trusted.

Am I missing something? What are the logic rules for when the system
updates a deployment directory?

thanks,
LB
 
L

LB

Simple. When the project is built, it reads the files from the source tree
and assembles the resulting artifacts into the build tree.

I understand and concur for .java / class files..

The build directory *is* the deployment directory.

What is an appropriate term for the /web/ directory?
You have lost me. What do you mean by "the system"? "deployment directory"?

Lew

Sorry, I should have been more clear. My problem is in managing html
and .jsp files, not in managing .java and class files. My .java stuff
is all straight, coherent and in order, absolutely inline with your
comments. Obviously the .jsp and html files are not even stored in
the source tree. (ouch.. Lately, I'm spending way more time in .jsp
then I ever spend in .java . I only wish it wasn't so... big
sigh.)

In netbeans the system has built two folders, BOTH of which have
copies of all of my .jsp, html and css files. One directory is "/
build/web/" (can I call this the build folder?) , and the other is
simply " /web/" (for lack of a better term I have been calling this
the deployment folder?)

Generally the .jsp and html files in /build/web/ are always up to
date... the .jsp and html files in the /web/ folder are generally
ALWAYS outdated... What I really want to know is why, Why, WHY is
this folder even here, with regard to html and .jsp's ? It clearly
doesn't update to any logic that I can figure out. Look at my
original posting. See those "<-- " arrows. Those are the two
directories that I am referring to.

Again, where I'm trying to go is a coherent understanding of which
directory to use when I need to deploy and / or make updates using non-
netbeans tools for html/xml editing.

thank you for your responses...
LB
 
T

Thomas Kellerer

LB, 25.07.2008 15:41:
Sorry, I should have been more clear. My problem is in managing html
and .jsp files, not in managing .java and class files. My .java stuff
is all straight, coherent and in order, absolutely inline with your
comments. Obviously the .jsp and html files are not even stored in
the source tree. (ouch.. Lately, I'm spending way more time in .jsp
then I ever spend in .java . I only wish it wasn't so... big
sigh.)

In netbeans the system has built two folders, BOTH of which have
copies of all of my .jsp, html and css files. One directory is "/
build/web/" (can I call this the build folder?)

Yes that's the build folder
and the other is simply " /web/" (for lack of a better term I have been calling this
the deployment folder?)

No, it's your *source* folder.

You should always edit the files in the source folder (that's the one that's displayed inside NB in the project tab)
NB will automatically copy modified files into the deployment folder.

Never ever, under no circumstances, edit files in the build folder.

Thomas
 
L

Lew

LB said:
Sorry, I should have been more clear.  My problem is in managing html
and .jsp files, not in managing .java and class files.  My .java stuff
is all straight, coherent and in order, absolutely inline with your
comments.  Obviously   the .jsp and html files are not even stored in
the source tree. (ouch.. Lately, I'm spending way more time in .jsp

Yes, they are stored in the source tree. JSPs and HTMLs are stored in
the project's web/ folder.
then I ever spend in .java  .  I only wish it wasn't so... big
sigh.)

Awwww, poor baby. Just out of curiosity, why in the world would that
be any sort of problem?
In netbeans the system has built two folders, BOTH of which have
copies of all of my .jsp, html and css files.  One directory is "/
build/web/"  (can I call this the build folder?) ,

That is the deployment folder.
and the other is
simply " /web/" (for lack of a better term I have been calling this
the deployment folder?)

That is the source folder.
Generally the .jsp and html files in /build/web/ are always up to
date... the .jsp and html files in the /web/ folder are generally
ALWAYS outdated...  What I really want to know is why, Why, WHY is
this folder even here, with regard to html and .jsp's ?  It clearly

build/ is the *deployment* folder. web/ is the *source* folder. The
files in build/web/ should be newer than the files in web/ because
they are built *from* the source folder. So of course they're newer!
doesn't update to any logic that I can figure out.  Look at my
original posting.  See those "<-- " arrows. Those are the two
directories that I am referring to.

Look at my original answer to your original post. build/web/ is the
*target*, to which files are copied, thus they are newer. web/ is the
*source*, so those files are older. They are not "out of date", they
are the source.
Again, where I'm trying to go is a coherent understanding of which
directory to use when I need to deploy and / or make updates using non-
netbeans tools for html/xml editing.

build/ is the *deployment* directory. web/ is the *source* directory.

dist/ is the distribution directory.

Things get copied

*from source (web/)*

*to deployment (build/)*

thus the deployment directory files are newer.

web/ is the source directory, build/ is the target.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top