ooo-build provides Ant xml to bootstrap a vanilla Ant installation with Maven support via Maven's Ant tasks. The bootstrap code fetches the bulk of ooo-build and the Maven tasks dynamically, so it allows Ant projects to use Maven and any other Maven-based tasks without requiring anything besides Ant from its users.
To use ooo-build, copy bootstrap.xml into your project alongside the build.xml for Ant. Then import the bootstrap code at the top of your build.xml with the following:
<property name="ooo-build.vers" value="2.10"/>
<ant antfile="bootstrap.xml"/>
<import file="${user.home}/.m2/ooo-build/${ooo-build.vers}/ooo-build.xml"/>
Once it's imported, add a dependency on -init-ooo
to your lowest common denominator targets, and
it's ready to use. Running that target makes the Maven Ant tasks available, loads
ant-contrib, and sets up ooo-build's Maven macros.
If a new version of ooo-build is released, you can change the value of ooo-build.vers
-- the
first property -- to start using it. bootstrap.xml
pulls its version from ooo-build.vers
, so it
can remain the same through versions.
mavendep fetches Maven dependencies for a pom file or inline dependency set, caches the results, and exposes filesets and path properties of the results.
<mavendep pom="pom.xml"/>
fetches the dependencies of pom.xml and makes them available as
pom.xml.path
for inclusion as javac
's classpathref or for other users of path like structures.
<mavendep id="tools">
<artifact:dependency groupId="com.threerings" artifactId="narya-tools" version="1.7"/>
</mavendep>
fetches com.threerings.narya-tools-1.7
and makes them available as tools.path
in the same way
as pom.xml.path
above.
Either the pom or id attribute must be given to the macro. All elements inside the mavendep
element are passed directly into Maven Ant Tasks' dependencies
element
All Attributes
- pom - The pom file to load dependencies from.
- id - The id to use for generated paths and files. Defaults to pom if not given.
- fileset - The name of the fileset to create containing the paths to the fetched dependencies. Defaults to id.fileset.
- path - The name of the path to create containing the fetched dependencies. Defaults to id.path.
- cacheDependencyRefs - If the dependencies should be cached. Defaults to true. Added in 2.3
- dependencyFile - The cache file to generate. Defaults to ${deploy.dir}/id.dependencies.
- pathProp - A property to fill in with the paths to all the dependencies. Not filled if no value is given.
- pathSep - The separator to use between paths in pathProp. Defaults to
,
. - destdir - A directory to copy the fetched dependencies to. The dependencies will just be the
artifactId
andpackaging
in the directory. ThegroupId
,qualifier
andversion
are all stripped off. Defaults to not copying. - scope - The scope of dependencies to fetch. Defaults to
compile
.
Removes the cache generated by mavendep
. It takes a pom
or id
attribute like mavendep
and
deletes the file that would be generated for that attribute by mavendep
All Attributes
- pom - The pom file used to load dependencies.
- id - The id to use for generated files. Defaults to pom if not given.
- dependencyFile - The cache file to delete. Defaults to ${deploy.dir}/id.dependencies.
Deploys a file to a Maven repository. If the maven.deploy.repo
property is set, the file and pom
are deployed to that repository. If it isn't set, the file and pom are installed in the user's
local repository.
All Attributes
- pom - The pom file to be deployed.
- file - The packaged artifact to be deployed.
- srcdir - If given, the directory of source to be zipped and deployed with the artifact. No source is deployed if the
srcdir
isn't set.
Fetches a Maven artifact and load tasks from it e.g. <maventaskdef groupId="com.threerings.ant" artifactId="javanailgun" version="1.0"/>
loads the javanailgun task. The macro checks if the
task has already been loaded before running, so it's safe to specify the same task in multiple
places.
All Attributes
- groupId - The group for the jar containing the tasks.
- artifactId - The artifact for the jar containing the tasks.
- version - The version of the jar containing the tasks.
- resource - The resource to be passed to the taskdef task. By default, this is
antlib.xml
in the path to thegroupId
andartifactId
egcom/threerings/ant/javanailgun/antlib.xml
for the initial example. - cacheDependencyRefs - If the dependencies should be cached. Defaults to true. Added in 2.3
- id - The base name of the created classpath and loader. Defaults to
groupId
.artifactId
-version
-taskdef. The classpath is accessible asid
.path and the loader is accessible asid
.loader for use in classpathref and loaderref in additional typedefs using this task.