YOUR FEEDBACK
E-Commerce 2.0
Brian wrote: I think we're heading in the right direction, but we've still...


2007 West
GOLD SPONSORS:
Active Endpoints
Your SOA Needs BPEL for Orchestration
BEA
Virtualized SOA: Adaptive Infrastructure for Demanding Applications
Nexaweb
Overcoming Bandwidth Challenges with Nexaweb
TIBCO
What is Service Virtualization?
SILVER SPONSORS:
WSO2
Using Web Services Technologies and FOSS Solutions
Click For 2007 East
Event Webcasts

2008 East
PLATINUM SPONSORS:
Appcelerator
Think Fast: Accelerate AJAX Development with Appcelerator
GOLD SPONSORS:
DreamFace Interactive
The Ultimate Framework for Creating Personalized Web 2.0 Mashups
ICEsoft
AJAX and Social Computing for the Enterprise
Kaazing
Enterprise Comet: Real–Time, Real–Time, or Real–Time Web 2.0?
Nexaweb
Now Playing: Desktop Apps in the Browser!
Sun
jMaki as an AJAX Mashup Framework
POWER PANELS:
The Business Value
of RIAs
What Lies Beyond AJAX?
KEYNOTES:
Douglas Crockford
Can We Fix the Web?
Anthony Franco
2008: The Year of the RIA
Click For 2007 Event Webcasts
SYS-CON.TV
TOP THREE LINKS YOU MUST CLICK ON


The Maven Build Process
A smooth transition

Digg This!

Page 2 of 3   « previous page   next page »

The key Maven concepts are described in the following that will aid in achieving build process objective.

Build Lifecycle
A typical project build lifecycle covers: prepare resources, compile sources, prepare test resources, compile test sources, execute test cases, and package component. Based on the best practices adopted in the project build, Maven has defined a sequence of tasks executed during this build lifecycle. Contrary to other build tools, it eases developers on the project from developing the build file for project that defines the list of build tasks and their sequence of execution.

Maven is extendable in that a build lifecycle can be defined on its own and associated with any project.

Configuration files
There are two critical configuration files in Maven: Settings.xml and POM.xml.

Default Settings.xml file is included in the Maven installation bundle and used to configure Maven execution. Unlike POM.xml, it is not project-specific. The configurations done here are local repository location, proxy server details, internal repository and its authentication information.

POM.xml is Maven configuration file for the project and is a one-stop-shop for all things concerning the project. It configures:

  • Maven Co-ordinates - Artifacts generated from Maven-enabled projects follow a specific address notation as groupid:artifactid:version that marks their location in the internal repository. The groupid, artifactid, and version are configured in POM.xml so a log4j-1.2.4 artifact will have its groupid as log4j, artifactid as log4j, and version as 1.2.4
  • POM Relationships - Maven is capable of handling project relationships like dependencies, inheritance, and aggregation. Inheritance is helpful in cases where certain configurations are unique across projects so these are defined in a 'Super POM' that's inherited by other project POM files. Aggregation is useful in a project that has multiple modules each with its own POM file; these modules are listed in the main project POM file and executed as a group. Dependencies are used to define the dependent projects and are detailed below.
  • Other Information - There's a build setting element that's used to configure a project's directory structure and manage plug-ins and reporting elements. Other project information like licenses, organization, developers, and mailing lists are configured here and incorporated into the project site built using Maven.
Dependencies Management
Almost all of the development projects depend on other existing frameworks, utilities, and APIs since this helps the projects to reuse rather than reinvent and so saves time, money, and resources. The projects might put all these dependent components in a folder and have a build tool use them when building the project. These artifacts also need to be maintained along with the project code base to be able to build later time with consistency. Most of the time these dependent components are checked into version management system along with the project code base.

This is not a preferred solution because:
1)  Dependent components (mostly JAR files) are binary files and version management systems are better at handling text files than binary files.
2)  Say there are two projects that depend on the Log4j-1.2.4 component. Each project would then have to maintain a copy of this component in the version management system. This increases the size of the version control database and adds to the hardware cost.
3)  And if a project is dependent on, say, 15 components and all of them are maintained in the version management system then normal operations like checkout and updating the versioning system will be slower.

Therefore, Maven recommends maintaining an enterprise-wide repository that will manage the dependent components and their versions. In Maven-speak these dependent components - and the components generated from the build process - are known as artifacts.

Repositories
Repositories are collections of artifacts that adhere to the Maven repository directory layout. To be a Maven repository artifact, it must live in the groupId/artifactId/version structure whose values are defined in the artifact's POM.xml project.

Maven deals with three kinds of repositories:

  • External repository: This Maven repository is located in http://repo1.maven.org and maintained by a bunch of contributors. Open source artifacts are maintained here per the Maven repository structure standard that locates the artifact under its groupid -> artifactid -> version.
  • Internal repository: This is an enterprise-wide repository maintained by an organization and holds in-house artifacts and the cache of any artifacts downloaded from an external repository. There are products available that help maintain this artifact repository. One such product is Artifactory, which is used in this process architecture. Artifactory has a friendly Web UI to manage repository like deploy artifact, download artifact, browse repository and manage user security.
  • Local repository: Maven maintains a cache of dependent artifacts of the project's built using Maven on local machine. This repository's location is configured in Settings.xml.
Repositories can be local or remote and are a place to store artifacts. Whenever a project has a dependency on an artifact, Maven will first attempt to use a local copy (in the local repository) of the specified artifact. If the artifact doesn't exist in the local repository, it will then attempt to download it from an internal repository. If the artifact isn't in the internal repository either then Maven reaches out to the external repository and downloads the artifact from there. The repository elements in Settings.xml specify the alternate repositories to search.


Page 2 of 3   « previous page   next page »

About Ravi Muthusubramanian
M.Ravi is a technical architect for the Banking & Capital Markets Division of Infosys. He has almost 8 years of experience in various facets of the software development life cycle and specializes in providing architecture and design solutions based on broad of spectrum of technologies including JEE, SOA, Message Broker, SAS and CRM.

LATEST JAVA STORIES & POSTS
Case Study: Java and the Mac
This is the story of a Mac application developer (okay - it's about two of them) who set out on a quest to find an application development tool based on Java so his boss would let him develop on the Mac platform, which he loved. There was only one catch - he had to find a tool th
A Lightweight Approach to SOA and BPM in Java Using jBPM
SOA is mostly associated with technologies such as BPEL, SCA and Web Services. But does SOA really imply these technologies? In this session we will show how you can use the service oriented approach while staying inside the Java world. jBPM is a powerful lightweight framework th
JavaOne 2008: Uncommon Java Bugs
Any large Java source base can have insidious and subtle bugs. Every experienced Java programmer knows that finding and fixing these bugs can be difficult and costly. Fortunately, there are a large number of free open source Java tools available that can be used to find and fix d
The 4 Core Principles of Agile Programming
One of the things I really enjoy at the moment is the recognition and adoption of agile programming as a fully fledged powerful way to deliver quality software projects. As its figurehead is a group of very talented individuals who have created the agile manifesto (http://agilema
JavaOne 2008: Sun Adds Comprehensive Video Capabilities to JavaFX
Sun Microsystems announced it has entered into a multi-year agreement with On2 Technologies to add comprehensive video capabilities, using On2 Technologies TrueMotion video codecs, to Sun's JavaFX, a family of products for creating Rich Internet Applications (RIAs) with immersive
JavaOne Archives - Dvorak Comments on AMD Intel Lawsuit on SYS-CON.TV
Conference in San Francisco. Dvorak held forth on a number of topics, including the new AMD/Intel lawsuit, the viability of Java and Sun, the value of (or lack thereof) of corporate PR, and whether or not a new book about Silicon Valley is really worth reading.
SUBSCRIBE TO THE WORLD'S MOST POWERFUL NEWSLETTERS
SUBSCRIBE TO OUR RSS FEEDS & GET YOUR SYS-CON NEWS LIVE!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021

SYS-CON FEATURED WHITEPAPERS

ADS BY GOOGLE
BREAKING JAVA NEWS
KongZhong Corporation Reports Unaudited First Quarter 2008 Financial Results
KongZhong Corporation , a leading wireless value-added services (WVAS) and wireless media co