Script to Quickly Create a Java Spring MVC Project

Posted by & filed under , , .

Logo_Java_SpringI’ve been (a bit) frustrated recently with the lack of support for quickly creating a Spring MVC project skeleton — there seems to be some maven archetypes but most of them I found to either not be maintained for a while and/or they install so much stuff that I decided not to use them. All I want sometimes if I’m trying out certain features is just a quick skeleton with a controller, a JSP view and the necessary directory structure plus basic configuration to start building a Spring MVC (small) app and quickly add in some code, compile and run in Tomcat to try it — I’m not interested in Hibernate, MySQL data sources, XML support, JSON, REST and all that — just a quick and dirty platform for some basic code scribbling.

Unfortunately as I said I could not find such a (you’d think) simple archetype — and since writing a maven archetype plugin is an overbearing process for what I need, I’ve decided to go with yet another simple bash script which creates the needed skeleton — similar to the Helper for Creating Firefox Extension script.

As with the Firefox Extension helper script, this is on github too — you can find the project under this link: https://github.com/liviutudor/SpringMVCSkeleton. It’s just a bash script (create_spring_mvc.sh) which when you launch creates everything under livmvc directory — you can edit the source and customize certain aspects of the created project if you want (e.g. project name, package names, URL’s etc).

Currently there is only one official release under tag 1.0.0 — though hopefully more will come as I might add command-line params support to allow for things like Hibernate/ORM etc.

I’ve enabled the Issues feature in github for it so if you have any requests/ideas please use that to let me know, or as usual drop me a line. Happy MVC-ing! 🙂

 

2 Responses to “Script to Quickly Create a Java Spring MVC Project”

  1. Sean Wong

    . you should consider using heredoc commands in your bash script, it’ll make your script easier to read without all the escapes

  2. Sean Wong

    . also mkdir -p is your friend
    mkdir -p src/main/{resources/config,webapp/WEB-INF/jsp,java/package} src/test/java