Efficient dev cycle with Maven, Tomcat/Glassfish, Archetype?

Development Cycle with Maven and Friends Use Maven to drive your code-build-test-deploy-release cycle. Start with Maven Archetype that suits closest to your web-app. This will create the whole folder structure for you and will add Jar depencies.

Use an embeded light-weight server like Jetty, this will be very fast on dev machine without sucking resources and is highly configurable. Plus, you can set it to auto-reload changes. Most of Maven project are supposed to be test-driven.

Of which Maven takes care of using it's surefire plug-in. So, every build will have a test phase. You can define multiple profile for various environments (test, dev, prod, Win, Unix..).

These profile will alter the behaviour of the project to be compatible with the environment. Use Cargo, again a Maven plugin to deploy your builds on test or production server, which can be Glassfish, Tomcat, Jetty or any oter webserver. Use Liquibase with or without Maven :) to manage your database changes the same way you manage your code change.

I came from almost similar project as yours in my previous company. Development with Maven makes things so smooth and the change is appreciable. A little Google search shows that someone has worked on archetypes for JSF and JPA with Spring Edit#1 -- added more details Feasibility and Ease of Use Maven is born out of neccessity to simplify the dev process for large and distributed code.

Maven is very well integrated with Eclipse -- so it's painless. Jetty keeps monitoring source folders, so your changes gets deployed almost immediately. You can customize the build to skip tests, to not build dependecies.

When you just edit a UI component, Jetty will silently copy it to "target" folder. If you're worried about copying and redeploying. You must read THIS to see how efficiently things are done, keeping in mind that you don't have to compile-test-deploy everytime you change a JSP or HTML.

That said, I would like to mention that Maven might be a challanging learning. This is an object oriented way of development cycle, to say. Most of us, who are used to build script, can find a bit tedious/verbose initially.

Resources I would suggest to go through the following resources Maven Book - Maven basics Automated Deployment with Maven - going the whole nine yards If you can, literally follow this pattern. Maven 2 Effective Implementation -- this book really helped us a lot.

With my primitive and inexperienced way of thinking, that when the project grows, with lots of classes, lots of test cases, i'd prefer skipping compiling or copying lots of files to the webapp folder (the i/o could be quite slow and will addup with the amount of the cycles), and perhaps also would like to skip tests when I just edit the user interface classes or something simple, so that I don't need to rerun all test everytime. – Albert Kam Jan 11 at 15:23 @Albert Kam added more details – Nishant Jan 11 at 15:56 Thank you very much for the detailed explanation. For me, it quiet a few of new things you mentioned, like cargo, profile, jetty, liquibase.

Just successfully deployed a simple webapp to tomcat 7 using cargo. I'll have to experiment more on the efficient lifecycle using tomcat.Im thinking of trying jetty, but im not sure, since the planned deployer is tomcat 7, and im doubtful if developing with jetty and finally put it into tomcat 7 in production is a good idea. Thanks again!

=) – Albert Kam Jan 11 at 17:30 @Albert Kam We also deploy the application in Tomcat6. But, we have Jetty embeded in project's pom.xml. This way, a developer do not have to install a server on his machine.

Plus, all the Jetty configuration is encapsulated in the pom. Xml -- so, a new dev just checks out the project from SVN and get's going. Zero installation.

On the other hand, our test deployer POM. Xml uses Cargo to deploy on remote Tomcat-6 server which is our offical test server. – Nishant Jan 11 at 18:07 @Albert Kam added more stuffs for further reading.

:) – Nishant Jan 11 at 18:14.

For the q2 : You can still run/debug app with tomcat from within the IDE (eclipse) even if you change the directory structure. (like the maven dir structure instead of eclipse's dynamic web dir structure) Project properties - > project facets - > Dynamic Web Module -> Click the appearing "further configuration available" and set your content dir and context root. You don't have to package everytime you want to run/debug it.

Another option is using Jetty And I am sure there are more options others will tell as well.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions