ant-wrapper

Apache Ant Command Line Wrapper

License

License

Categories

Categories

Ant Build Tools
GroupId

GroupId

com.rimerosolutions.ant
ArtifactId

ArtifactId

ant-wrapper
Last Version

Last Version

0.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

ant-wrapper
Apache Ant Command Line Wrapper
Project URL

Project URL

https://github.com/rimerosolutions/ant-wrapper
Source Code Management

Source Code Management

https://github.com/rimerosolutions/ant-wrapper

Download ant-wrapper

How to add to project

<!-- https://jarcasting.com/artifacts/com.rimerosolutions.ant/ant-wrapper/ -->
<dependency>
    <groupId>com.rimerosolutions.ant</groupId>
    <artifactId>ant-wrapper</artifactId>
    <version>0.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.rimerosolutions.ant/ant-wrapper/
implementation 'com.rimerosolutions.ant:ant-wrapper:0.0.1'
// https://jarcasting.com/artifacts/com.rimerosolutions.ant/ant-wrapper/
implementation ("com.rimerosolutions.ant:ant-wrapper:0.0.1")
'com.rimerosolutions.ant:ant-wrapper:jar:0.0.1'
<dependency org="com.rimerosolutions.ant" name="ant-wrapper" rev="0.0.1">
  <artifact name="ant-wrapper" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.rimerosolutions.ant', module='ant-wrapper', version='0.0.1')
)
libraryDependencies += "com.rimerosolutions.ant" % "ant-wrapper" % "0.0.1"
[com.rimerosolutions.ant/ant-wrapper "0.0.1"]

Dependencies

compile (8)

Group / Artifact Type Version
org.apache.ant : ant-launcher jar 1.7.0
org.apache.ant : ant jar 1.7.0
com.rimerosolutions.ant : ant-git-tasks Optional jar 0.0.1-SNAPSHOT
org.eclipse.jgit : org.eclipse.jgit.ant Optional jar 3.0.0.201306101825-r
org.eclipse.jgit : org.eclipse.jgit Optional jar 3.0.0.201306101825-r
com.jcraft : jsch Optional jar 0.1.50
net.sourceforge.cobertura : cobertura Optional jar 1.9.4.1
com.google.code.findbugs : findbugs-ant Optional jar 2.0.1

test (4)

Group / Artifact Type Version
org.mockito : mockito-all jar 1.9.5
org.hamcrest : hamcrest-all jar 1.3
junit : junit jar 4.11
org.apache.ant : ant-junit jar 1.7.1

Project Modules

There are no modules declared in this project.

Ant Command Line Wrapper

https://travis-ci.org/rimerosolutions/ant-wrapper.png

Summary

This is an Apache Ant command line wrapper similar to the Gradle command line wrapper.

It provides an antw command wrapper to ant that will auto-download and build your project for a requested Apache Ant version.

This ensure that as long as your build file is good, other people will be able to build your project easily with no prior Apache Ant setup.

What can you do with it?

  • You can generate an Ant wrapper for a project from a machine with an existing Ant installation.
  • You can share the project without requiring an existing Ant installation from the ‘application builder’.

The wrapper functionality is provided via a custom Apache Ant task.

Notes

  • This project was only tested with Apache Ant 1.7.0 and above, under Mac OSX, Linux and Windows.
  • The tool has not been tested with very complex builds where many classloaders could be involved.

Building the program

You’ll need a recent Apache Ant version (Only tested with Ant 1.7.0 and above).

From the project directory, run the following command to build the jar file:

ant

You can also generate the Ant wrapper for the project itself!

ant wrapper

Once the wrapper is installed, you can play with it, as you please:

./antw -projecthelp

Integration

Using Apache Ivy (Recommended)

If your Ant build already uses Apache Ivy as dependency manager, take a look at the ant-wrapper-example.

If you don’t want to use Ivy, you can follow one of the 2 next approaches, after copying the ant-wrapper jar ‘somewhere’.

The build process will generate the resulting jar archive in the project dist folder.

You have 2 installation options:

  • Drop the jar at the root of your existing projects or any other given location (Ant taskdef with classpath).
  • Drop the jar in your ANT_HOME/lib folder (ant taskdef without any classpath setup).

Download the Ant task Jar file from Maven central using the link below.

./download.png

Using AntLib

It’s also possible to use Antlib and XML namespaces to refer to the Ant wrapper custom task.

<?xml version="1.0"?>
<project name="AntWrapperProject" 
         xmlns:wrapper="antlib:com.rimerosolutions.ant.wrapper.tasks"
         default="wrapper">
 <!-- The optional Ant Task also accepts a baseDistributionUrl properties for the Ant zip files binaries -->
 <!-- if you dropped the wrapper jar in ANT_HOME/lib -->
 <taskdef uri="antlib:com.rimerosolutions.ant.wrapper.tasks"
          resource="com/rimerosolutions/ant/wrapper/tasks/antlib.xml"/>
	
 <!-- if you have the wrapper jar at the root folder of your project 
	    <taskdef uri="antlib:com.rimerosolutions.ant.wrapper.tasks"
                  resource="com/rimerosolutions/ant/wrapper/tasks/antlib.xml"
                  classpath="ant-wrapper-0.0.1.jar"/>
 --> 

 <target name="wrapper">
   <wrapper:wrapper/>
   <!-- 
   <wrapper:wrapper baseDistributionUrl="http://archive.apache.org/dist/ant/binaries"/>
                    antVersion="1.8.0"/> 
   -->
 </target>
</project>

Sample build script (no Antlib)

<?xml version="1.0"?>
<project name="AntWrapperProject" default="wrapper">
<!-- The optional Ant Task also accepts a baseDistributionUrl 
     properties for the Ant zip files binaries -->
<!-- if you dropped the wrapper jar in ANT_HOME/lib -->
<taskdef name="genAntWrapper" classname="com.rimerosolutions.ant.wrapper.tasks.AntWrapperTask"/>
	
	<!-- if you have the wrapper jar at the root folder of your project 
	<taskdef name="genAntWrapper" classname="com.rimerosolutions.ant.wrapper.tasks.AntWrapperTask">
	<classpath>
	    <pathelement location="ant-wrapper-0.0.1.jar"/>
	  </classpath>
  </taskdef>
  --> 

	<target name="wrapper">
     <genAntWrapper/>
     <!-- 
     <genAntWrapper baseDistributionUrl="http://archive.apache.org/dist/ant/binaries"
                    antVersion="1.8.0"/> 
     -->
    </target>
</project>

Wrapper generation

With the above sample script, accordingly to the taskdef approach that you selected, run the following:

ant wrapper

This will create 5 main artefacts at the root of your project folder :

  • antw : A UNIX command wrapper.
  • antw.bat : A Windows command wrapper.
  • antw.cmd : Environment variable helper for Windows.
  • lcp.bat : The usual Windows classpath utility script.
  • wrapper : A folder containing the launcher supporting files.

Testing

  • Run your current project via the Ant wrapper instead of your local Ant installation.
  • Build your project with the Ant wrapper on a machine that doesn’t have an existing Ant installation.

Task properties

name Description Value
baseDistributionUrl The download base distribution URL The default value is : http://archive.apache.org/dist/ant/binaries
antVersion The ant version to use for the wrapper The default value is auto-detected unless specified.
com.rimerosolutions.ant

Rimero Solutions Inc.

Versions

Version
0.0.1