24.8.13

A couple of experiments with advanced maven projects.

Maven is increasingly being used to do more than build large, heterogenous projects: 
  • It provides idioms for the entire software development life cycle.
  • Its no longer java specific: See the ambari and bigtop projects as examples of maven powered builds which manage heterognous, non java projects.
  • Unlike RPMs, the integration with the maven's repository framework makes it easy to release artifacts using the same tool that you use to build them. 
I've created a small example project to demonstrate some of the trickier/advanced maven features which become important in real-world projects, which I'll update over time with more examples.  The code for this stuff is here: https://github.com/jayunit100/maven-examples.

Experiment 0: Super modules: Whats inherited? 

If you run the "mvn test" command, you'll notice that two tests run.  These are in the submodule.  However, if you look closely, the submodule has no dependencies (missing junit) nor the build declaration to run surefire.  This tells us that inheritance of all the super module top level tags cascades into the submodule.  So the take home: If you have a family of related projects with common dependencies and system property configurations ~ you can use maven submodules to structure them.





Experiment 1: Environment Variables.

If we export an environment variable "X" before running "mvn test", we find that it will be available in the submodule as "env.X" in the System.getProperties() function, but also available as "X" in the System.getenv() properties. 

No comments:

Post a Comment