GroboUtils

About GroboUtils

Sourceforge
Project

For Developers

GroboCodeCoverage version 1.1.0

grobo-rezip: GroboCoverage Ant Tasks

Author:Matt Albrecht

All Tasks

grobo-rezip

Description

Alters zip and zip-like files to contain new files. Also, alters zips within zips. Used for modifying deployment archives (such as EAR files) to include coverage-compiled classes and the GroboCoverage runtime library.

The task is really a container for many alteration sub-tasks. Each top-level sub-task takes a source, and outputs a destination to a file. They may each have their own alteration sub-tasks, but these will output the altered zip file to the owning sub-task's zip file.


Nested Elements

alterZip

The primary alteration sub-task. All other alter sub-tasks are based on this one, and so have the same attributes and nested elements as this one (plus a few more).

All alter sub-tasks can include other alter sub-tasks inside them. This means that a zip file inside another zip file will be altered.


Parameters

AttributeDescriptionRequired
srcFor top-level alter sub-tasks, this refers to the location of the original source zip file. For inner alter sub-tasks, this refers to the zip file location inside the owning zip file's directory structure.Yes
destFor top-level alter sub-tasks, this refers to the output location of the modified zip file; this defaults to the src parameter, overwriting the original. This isn't used for inner alter sub-tasks.No

Nested Elements

fileset

(aliased as zipfileset) the ZipFileSet to define new entries to put into the modified zip file. This will overwrite any existing file in the modified zip file with the same name and path.

Parameters

AttributeDescriptionRequired
replaceOnlyIf set to "true", then only the files in this fileset that are already in the original zip file will be included. Default is "false". Useful for including covered classes that are in the original, but no others. No


alterWar

A variation of the alterZip sub-task, designed for use with .war files.

It has the same parameters and nested elements as alterZip, except for:


Nested Elements

classes

A short-hand for a ZipFileSet that presets the path prefix to WEB-INF/classes/. By default, the "replaceOnly" attribute is set to "true", but this can be altered.

lib

A short-hand for a ZipFileSet that presets the path prefix to WEB-INF/lib/.


alterJar

A variation of the alterZip sub-task, designed for use with .jar files.

Currently, there is no difference between this nested element and the alterZip element. Eventually, alterJar will allow for modifications to the META-INF/MANIFEST.MF file (for jobs such as appending to the classpath list, and so on).



alterEar

A variation of the alterZip sub-task, designed for use with .ear files.

Currently, there is no difference between this nested element and the alterZip element. Eventually, alterEar will allow for modifications to the application.xml file (for jobs such as appending to the classpath list, and so on).



Examples

<grobo-rezip>
    <alterEar src="${outdir}/myapp.ear">
        <alterWar src="web1.war">
            <lib file="${3rdparty}/GroboCoverage-1.1.0-runtime.jar" />
            <classes dir="${coverage.classes}" />
            
            <alterJar src="WEB-INF/lib/myfiles.jar">
                <fileset dir="${coverage.classes}">
                    <includes name="com/my/files/**" />
                </fileset>
            </alterJar>
        </alterWar>
        
        <fileset file="${testdir}/9cactus.war" />
    </alterEar>
</grobo-rezip>
        
This task alters the contents of ${outdir}/myapp.ear, and replaces the original when complete.

The contents of the .ear file remain the same, except for web1.war, which gets modified, and a new file, 9cactus.war, gets added to the root of the EAR directory structure.

web1.war gets modified to reference the code-coverage enabled files. The contents remain the same, except for the following:

  • the required runtime library for GroboCoverage coverage-enabled class files gets included in the WAR file lib directory structure;
  • the coverage-enabled class files replace the originals, but any original class file not coverage-enabled will remain in place (since the non-coverage-enabled files do not exist in ${coverage.classes});
  • the inner jar file, WEB-INF/lib/myfiles.jar gets modified, by replacing the com.my.files package and sub-package classes with the coverage-enabled versions.


All Tasks




SourceForge Logo
This space graciously provided by the SourceForge project
Copyright © 2002-2004 GroboUtils Project.
All rights reserved.