Hello everyone I was just going trough http://static.springsource.org/docs/Spring-MVC-step-by-step/part1.html spring tutorial, and I thought its old I'll think something better on my own. For starters how do I start spring project with maven, which archtype should I choose? I wanna create simple spring app, write class which I will deploy to jboss, spring will instansiate it at startup .. that is what have in mind for now .. for now I need to start it first
The Spring 3 samples are maven based and are a good starting point. Just get them from their source control: https://src.springframework.org/svn/spring-samples/
Another option would be to use an AppFuse archetype like the appfuse-modular-spring
to create a modular application with Hibernate, Spring and Spring MVC.
An archetype only sets up your POM and directory structure based on a template. I wouldn't get hung up on which one to choose.
The MVC tutorial uses the following structure:
src
- Java source codewar
- Web resources, web.xml, and Spring context filesIf you want to use the Maven standards, this should convert to
src/main/java
- Java source codesrc/main/resources
- Spring context files and configuration (non-web related) files, which you'd like to be on the classpath (i.e. WEB-INF/classes) in a webappsrc/main/webapp
- Web-related resources which you'd like to appear at the root of your webapp/.war fileAnd the <packaging>
for a webapp should be war
.
Update: I'd recommend taking a look at the free Maven by Example book, it walks you through building a sample application using Maven, including a chapter on "A Simple Web Application". There is also Maven: The Complete Reference for more reference.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With