views:

62

answers:

3

I first tried the spring mvc tutorial using eclipse, but got a bit frustration and just did the first few steps using netbeans.

Netbeans, using a java web template, creates folders like:

/webpages
/webpages/meta-inf/
/webpages/web-inf/
/webpages/*.jsp
/source packages
/source packages/xxxx/xxx.java
/test packages/
/libraries
/configuration files
/configuration files/manifest.mf, context.xml, web.xml

The spring tutorial suggests to create:

/appname/
/appname/src
/appname/war (jsp's go here)
/appname/war/web.xml
/appname/build.xml
/appname/build.properties
/appname/war/WEB-INF/appname-servlet.xml
/appname/src/appname/web/HelloController.java

Now my question is, if I modified my netbeans project to mirror this structure, will it break the automatic build that netbeans gives me?

I downloaded the full version of netbeans, so I'm not sure if Ant comes with it or not?

When using the IDE's build/run, I guess I am using the IDE's build engine, can I force it to use Ant somehow or its better just to use Ant at the command line?

A: 

One option, becaue you have Netbeans, is to do this using Maven. Maven is an external build system (and much more) that netbeans can use. Create a new project and select a Maven project. Then create a simple Java web application (or a spring application if you want to dive right in). The directory structure that is set up will be correct.

darren
Worth a try, I guess, but my suspicion is that Maven will lead to more problems than it fixes. I've had trouble with Maven every time I tried this kind of thing.
Carl Smotricz
The spring tutorial isn't using the maven standard layout so this won't help. http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html
NA
To be a little more specific, Maven *will* set up and insist on a directory structure radically different from what's outlined in the Spring tutorial; so not much gained there. Just my opinion, of course.
Carl Smotricz
A: 

As an Eclipse user, I'm not really good with NetBeans. But I do know that the "internal build system" is based on Ant and a pretty elaborate project framework Ant file.

You could dig your way through the maze of files and targets and fix the problem manually, but my suggestion would be to adapt the Spring tutorial's names to the directory structure NetBeans gave you.

Carl Smotricz
+1  A: 

Here's the Spring tutorial reworked for NetBeans.

NA
+1, looks helpful.
Carl Smotricz