Adam Bien's Weblog

Monday May 13, 2013

Maven: Lifecycle Hooks Lead To Infrequent Integrations

You could build, test and deploy the entire Java EE Application and even create a working application server from scratch with a single mvm clean install command. The only problem is: it will take forever and you will have to repeat the whole process over and over again, even if you were only interested in particular build steps.

If mvm clean install would just execute the unit tests, your feedback will be significantly faster. Instead of waiting hours, you get the first results in seconds.

A series of composable jobs, each executing a goal or maven plugin, could be realized with http://jenkins-ci.org, or a simple shell / batch script on the developer's machine.

Instead of executing all plugins at once by hooking them to the lifecycle, you could implement a series of chained together jobs. E.g.

  1. Job: mvm clean install (mvn clean package suffices as well)
  2. Job: mvn failsafe:integration-test
  3. Job: server setup
  4. Job: deployment
  5. Job: system test execution
  6. Job: quality assurance
  7. Job: promotion
  8. Job: tagging / release
  9. ...

The faster the feedback, the more valuable it gets. A monolithic mvn clean install leads to too long builds, less feedback and becomes less valuable for Continuous Integration. CI degrades to nightly builds…

Just start with an essential setup essential and not with a super-pom.

[See also an in-depth discussion in the "Real World Java EE Night Hacks--Dissecting the Business Tier" book, page 136 in, chapter "Continuous Integration and QA"]

See you at Java EE Workshops at MUC Airport (Effective JavaEE)!


NEW workshop: Microservices with Java EE 7 and Java 8, January 26th, 2015, Airport Munich

A book about rethinking Java EE Patterns

Comments:

If you are looking for more information: This is what the Continuous Delivery book talks about in great detail and length .

Posted by Eberhard Wolff on May 13, 2013 at 04:19 PM CEST #

@Eberhard,

thanks! Also it is common sense to keep the build short and "modular", somehow I meet "GOD"-pom.xml over and over again :-)

thanks for your comment!

Posted by Adam Bien on May 14, 2013 at 11:24 AM CEST #

Well, why the need for a "mvn install" if you could just call "mvn test" and "mvn verify"?

Posted by Marcus Kraßmann on May 25, 2013 at 02:00 PM CEST #

@Marcus,

In the first build I usually create a WAR which is going to be reused in all downstream jobs.

JavaEE 6+7 apps tend to be rather small (not a lot dependencies are needed), so that does not cause any performance problems.

But: you could package your app later as well.

Btw. even in my case install is too much. "package" would suffice as well.

thanks for you comment!,

adam

Posted by Adam Bien on May 27, 2013 at 02:12 PM CEST #

Post a Comment:
  • HTML Syntax: NOT allowed
realworldpatterns.com
...the last 150 posts
...the last 10 comments
License