Sponsors

Microsoft


TechWell

We have 2759 guests and 5 members online

Home CM Basics A Little More Maven 1.0.2

A Little More Maven 1.0.2

E-mail
Written by Bob Aiello   
Tuesday, 03 June 2008 12:46
bajunebasicskeyboard08-1.jpgLast month I introduced Maven 1.0.2 as a legacy build tool that build engineers should know about because we are often called upon on to support legacy build systems. The maven 1.0.2 genapp option creates a project.xml (shown below) that includes a build section that shows us what should and should not be built.



The build sections below starts with the
         
<build>

directive. In this directive there is an include section that shows the source Directory src/java where the java source (to be compiled) is located. The jelly code can be a bit tough to read, but it is also clear that the project.xml also includes a section for unit tests and java sources that should be excluded.

    <sourceDirectory>src/java</sourceDirectory>

    <unitTestSourceDirectory>src/test</unitTestSourceDirectory>

    <unitTest>

      <includes>

        <include>**/*Test.java</include>

      </includes>

      <excludes>

        <exclude>**/NaughtyTest.java</exclude>

Note that the some of the standards for where the unit tests should be located have changed, but here is a complete example project.xml created by the genapp (mentioned in last month's article).


<?xml version="1.0" encoding="UTF-8"?>

<!--

/*

 * Copyright 2001-2004 The Apache Software Foundation.

 *

 * Licensed under the Apache License, Version 2.0 (the "License");

 * you may not use this file except in compliance with the License.

 * You may obtain a copy of the License at

 *

 *      http://www.apache.org/licenses/LICENSE-2.0

 *

 * Unless required by applicable law or agreed to in writing, software

 * distributed under the License is distributed on an "AS IS" BASIS,

 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

 * See the License for the specific language governing permissions and

 * limitations under the License.

 */

 -->

<project>

  <!-- the version of maven's project object model -->

  <pomVersion>3</pomVersion>

  <!-- a unique name for this project -->

  <id>cm-application</id>

  <!-- a short but descriptive name for the project -->

  <name>CM Application</name>

  <!-- The version of the project under development, e.g.

       1.1, 1.2, 2.0-SNAPSHOT -->

  <currentVersion>1.0</currentVersion>

  <!-- details about the organization that 'owns' the project -->

  <organization>

    <name>Apache Software Foundation</name>

    <url>http://www.apache.org/</url>

    <logo>http://maven.apache.org/images/jakarta-logo-blue.gif</logo>

  </organization>

  <!-- the year the project started -->

  <inceptionYear>2002</inceptionYear>

  <package>cmc.testapp</package>

  <logo>http://maven.apache.org/images/maven.jpg</logo>

  <description>A collection of example projects showing how to use maven in different situations</description>

  <!-- a short description of what the project does -->

  <shortDescription>How to use maven in different situations</shortDescription>

  <!-- the project home page -->

  <url>http://maven.apache.org/reference/plugins/examples/</url>

  <issueTrackingUrl>http://nagoya.apache.org/scarab/servlet/scarab/</issueTrackingUrl>

  <siteAddress>jakarta.apache.org</siteAddress>

  <siteDirectory>/www/maven.apache.org/reference/plugins/examples/</siteDirectory>

  <distributionDirectory>/www/maven.apache.org/builds/</distributionDirectory>

  <!-- the version control repository and http url for online access

       the connection element has the form:

       scm:<system>:<system specific connection string> -->

  <repository>

    <connection>scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:maven-        plugins/examples</connection>

    <url>http://cvs.apache.org/viewcvs/maven-plugins/examples/</url>

  </repository>

  <!-- any mailing lists for the project -->

  <mailingLists/>

  <!-- who the developers are for the project -->

  <developers/>

  <!-- jar files the project is dependent on -->

  <dependencies/>

  <!-- build information for the project -->

  <build>

    <nagEmailAddress>turbine-maven-dev@jakarta.apache.org</nagEmailAddress>

    <sourceDirectory>src/java</sourceDirectory>

    <unitTestSourceDirectory>src/test</unitTestSourceDirectory>

    <unitTest>

      <includes>

        <include>**/*Test.java</include>

      </includes>

      <excludes>

        <exclude>**/NaughtyTest.java</exclude>

      </excludes>

    </unitTest>

    <resources>

      <resource>

        <directory>src/conf</directory>

        <includes>

          <include>*.properties</include>

        </includes>

      </resource>

    </resources>

  </build>

</project>

You will also find a project.properties file. As noted on the Maven Apache website

 (http://maven.apache.org/maven-1.x/reference/properties.html)

which is used to set defaults values for properties. There are other properties files that can be used as well.


# -------------------------------------------------------------------
# Copyright 2001-2004 The Apache Software Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# -------------------------------------------------------------------
 

maven.xdoc.date=left

## maven.xdoc.version=${pom.currentVersion}

 


Maven 1.0.2 is a legacy Java build tool that is still being used in many shops to support Java builds. Of course, Maven 2 and Ant are being increasingly used by most Java shops for building java applications. But still, build engineers should spend a little time learning Maven 1.0.2 and be prepared to support those legacy builds!

Hey drop me a line and let me know what build engineering challenges YOU are facing!

 


Bob Aiello is the Editor-in-Chief for CM Crossroads and an independent consultant specializing in Software Process Improvement including Software Configuration and Release Management. Mr. Aiello has over 25 years experience as a technical manager in several top NYC Financial Services firms where he had had company-wide responsibility for CM, often providing hands-on technical support for enterprise Source Code Management tools, SOX/Cobit compliance, build engineering, continuous integration and automated application deployment. Bob is a long standing member of the Steering Committee of the NYC Software Process Improvement Network (CitySPIN), where he serves as the chair of the CM SIG. Mr. Aiello holds a Masters in Industrial Psychology from NYU and a B.S. in Computer Science and Math from Hofstra University. You may contact Mr. Aiello at raiello@acm.org or link with him at http://www.linkedin.com/in/bobaiello

Trackback(0)

Comments (0)add comment


Write comment

You must be logged in to post a comment. Please register if you do not have an account yet.

busy
Last Updated on Friday, 06 June 2008 04:22
 
509 Bandwidth Limit Exceeded

Bandwidth Limit Exceeded

The server is temporarily unable to service your request due to the site owner reaching his/her bandwidth limit. Please try again later.