Jan 26th, 2011, 06:47 PM
Maven + Spring + web app Project structure in IDEA
I have done a basic project in Spring. Now I'm trying to step up and work through a tutorial I found that has Spring in a web app. That's fine but unlike the tutorial, we use Maven and we use IDEA 9. So I have tried some experiments to create a project structure with correct content to have an IDEA project that uses Maven to build, is a web app, and uses Spring. Can anyone help me with this?
I've got the following from asking for a Maven module that supports the webapp and Spring frameworks:
In a project I created to see what I would get for Spring and Maven, I also got a
java directory under main
a test directory under src
a classpath item
and a project item
and there is no pom.
Both of these are a problem and are missing pieces but I'm not sure what the proper, complete structure should be. This is partly because all the examples I can find use Eclipse. That's fine but we don't and I don't know enough to do the translation.
Also, is there something like a tutorial online that would cover putting all these pieces together with a line-by-line explanation of the Spring pieces? All the tutorials I've seen simply say things to the effect of "put this code in class abc and then build." Or, is there a book that has a good treatment of putting all these different technologies together "under one tent"? Thanks.
Last edited by kduncan; Jan 26th, 2011 at 06:48 PM.
Reason: Missing a word.
Jan 27th, 2011, 08:25 AM
my suggestion is to learn to use and use Maven from command line. The IDE plugins for Maven never work 100% well and they hide some of the power of Maven itself. You can create the structure from command line and then import the created structure in a IDEA project.
That said, I believe there are some good "unofficial" mvn archetypes to build Spring-based webapps. I also, however, suggest you take a look at Spring Roo. I found it an invaluable tool in aiding creation and maintenance of Spring-based webapps.
Jan 31st, 2011, 10:54 AM
Actually, when using IDEA 9, when you ask it to create a project, just select "Maven Model" and that should create it (if you want to use an archetype, maven-archetype-quickstart and maven-archetype-webapp are pretty good starting points for JARs and WARs, respectively).
I haven't seen much in the way of problems with the IDEA maven support - it's solid. That said, you COULD use AppFuse or Roo to kickstart the project, though both have their drawbacks...
Hope this helps
Tags for this Thread