First we will start with a brand new Maven project:
Step #1: Generate a Maven Webapp project:
mvn archetype:generate
The command above provides us a lot of archetype options. For this demo, we are going to choose #83 that is: maven-archetype-webapp (An archetype which contains a sample Maven Webapp project.).
Below (in bold) were the options I chose:
Choose a number: 80: 83
Choose version:
1: 1.0
2: 1.0-alpha-1
3: 1.0-alpha-2
4: 1.0-alpha-3
5: 1.0-alpha-4
Choose a number: : 5
Define value for property 'groupId': : com.mayabansi.webappdemo
Define value for property 'artifactId': : MavenSpringHibernateMockitoDemo
Define value for property 'version': 1.0-SNAPSHOT:
Define value for property 'package': com.mayabansi.webappdemo:
(NOTE: I have left out the rest of standard maven output for brevity)
Above command created the project structure below:
rhasija@rhasija-desktop ~/workspace/blog_projects/MavenSpringHibernateMockitoDemo $ find . . ./src ./src/main ./src/main/webapp ./src/main/webapp/index.jsp ./src/main/webapp/WEB-INF ./src/main/webapp/WEB-INF/web.xml ./src/main/resources ./pom.xml rhasija@rhasija-desktop ~/workspace/blog_projects/MavenSpringHibernateMockitoDemo $
Step #2: Add basic project to source code control.
Step #3: Make project ready for IntelliJ Idea/Eclipse.
Step #4: Add JBoss Remote Repository as alternate remote repository for Hibernate artifacts.
Step #5: Add Hibernate related dependencies.
Step #6: Add Enterprise Bundle repository to settings.xml
Step #7: Add Spring MVC related dependencies.
Step #8: Add Mockito dependency.
NOTE: The example is complete. I will keep adding to it as I learn new things so as to make the example project richer.
The entire project can be downloaded from GitHub or you can use Git to checkout the project:
git clone git@github.com:RaviH/MavenSpringHibernateMockito.git
I have actually created one. Check out at http://code.google.com/p/spring-archetypes/. Feel free to send me any improvement patches. Cheers!
ReplyDeleteHey 1nd1go (Indigo) :-),
ReplyDeleteThank you for the comment. I will surely check out your project!!! Thank you for the good work!
Ravi