Antlion
Welcome
License
 
How-To Guides
Getting Started
Libraries
Artifacts
Subprojects
Repositories
Policy Strategies
Format Strings
Extending Antlion
FAQ
 
Tutorials
First Tutorial: Simple
 
Ant Tasks
<artifact>
<libraryDef>
<library>
<library-policy>
inner processors
inner repositories
<library-type>
<library-repository>
<library-urlrepository>
<library-mavenrepository>
<library-repositoryset>
<create-artifact>
<subprojects>
<run-subproject>
<replace-target>
 
Optional Tasks
About optional tasks
RegexpTokenFormatter
 
library-mavenrepository
This element represents a Maven repository, emulating the usage of many of the project properties that Maven uses, as well. See the Maven description about remote repositories and the repository layout.

The <mavenrepository> element, like all repositories, can either live inside a <libraryDef> or as a stand-alone datatype. In the stand-alone form, it needs to have an id so that a <libraryDef> may reference it. [TODO: update this section]

If the maven.mode.online property is set to "false" (it defaults to "true"), then only cached versions of the files will be retrieved, even if they're SNAPSHOT versions.

The files found in the Maven remote repository will be downloaded to the local filesystem when the <libraryDef> attempts to find the files (that is, wherever the <libraryDef> task containing the <mavenrepository> is located in the Ant file).

Maven Proxy Support

since Antlion 0.4.0

In order to support the Maven proxy feature, the <mavenrepository> supports these "magic" Ant properties:
  • maven.proxy.host: The IP or address of your proxy.
  • maven.proxy.port: The port number of your proxy.
  • maven.proxy.username: User name if your proxy requires authentication.
  • maven.proxy.password: Password if your proxy requires authentication.
If the maven.proxy.host property is present in the Ant project when the <libraryDef> containing the <mavenrepository> element is run, then the <mavenrepository> will implicitly add a <setproxy> task, setting all the corresponding values to these Maven properties.

Since this uses the Ant optional task <setproxy>, the other Maven Maven proxy properties, maven.proxy.ntlm.host and maven.proxy.ntlm.domain, are not currently supported. However, since the <setproxy> task supports SOCKS proxies, then these other "magic" Ant properties are supported:
  • maven.socksproxy.host: The IP or address of your SOCKS proxy.
  • maven.socksproxy.port: The port number of your SOCKS proxy.
If the maven.socksproxy.host property is set, then the <setproxy> task will be executed, even if the maven.proxy.host is not set.

Note that, if these proxy properties are set, then the <mavenrepository> will override any existing values set by another <setproxy> task, and the setup proxy settings will be kept in place after the <mavenrepository> finishes. With this condition, this proxy feature should be considered as only a tool to ease migration from Maven issues. The long term "right" way is to explicitly set the proxy with the <setproxy> task in your Ant script.

To use the proxy capabilities, you will need to have ant-nodeps.jar in your Ant classpath. This comes standard with Ant distributions, and requires no additional outside dependencies.

Parameters
Attribute Description Required
cachedir Local directory to store all the downloaded repository files.

If this parameter is not set, then it uses the Maven default of the Ant property ${maven.repo.local}. If that property is not set, then it defaults to ${maven.home.local}/repository. If the property maven.home.local is not set, then it defaults to ${user.home}/.maven.
No
remote The remote repository location (must be an URL). You can specify multiple repositories by separating each URL with a comma (","). This conforms to the Multiple Repositories convention.

This parameter defaults to the same as Maven - the value of the Ant property ${maven.repo.remote}, which, if not set, defaults to http://www.ibiblio.org/maven.

Note that any URL supported by Java can be used here, even ftp: or file:.
No
cacheFormat Since Antlion 0.3.1

Sets the format of the location where the locally cached files will be placed. If the format isn't matched on a file, then, based on the setting of failCacheToDefault, either the build will fail, or the repository's path will be used instead. The cacheFormat attribute defaults to using the repository's path.
No
failCacheToDefault Since Antlion 0.3.1

If a file doesn't match the cacheFormat, then, by default, the build will fail with a descriptive message. However, if instead you would like to "fail-over" to the repository's path for the file, then set this attribute to "true".
No
checkUpdates Since Antlion 0.4.0

By default, snapshot libraries will always be downloaded, unless offline, in which case the cached version is used; and non-snapshot library files will be downloaded only if there isn't a cached version. By enabling this parameter, Antlion will instead inspect the remote repository's timestamp (if available): for all libraries, if there is a cached version, then its date/timestamp is compared against the repository, and downloaded if out-of-date. This should only be used if you know that the remote repository supports time retrieval (such as most HTTP servers provide).
No
if Since Antlion 0.6.0

Only use this repository if the named property is set (regardless of the property's value).
No
unless Since Antlion 0.6.0

Only use this repository if the named property is not set (regardless of the property's value).
No

Nested Elements

basicAuth

Passes a username/password to the repository using basic HTTP authentication, which essentially passes the password in clear text.

Parameters
Attribute Description Required
username Username for 'BASIC' http authentication. Yes
password Password for 'BASIC' http authentication. Yes


Examples
<property name="cachedir" location="cache" />
<libraryDef>
    <mavenrepository cachedir="${cachedir}" />
    
    <library>
        <lib-entry groupid="log4j" artifactid="log4j" version="1.2.6" />
    </library>
</libraryDef>
Uses the default Maven repository (http://www.ibiblio.com/maven) to find the log4j version 1.2.6 jar file. If found (which it should be if the build is connected to the internet), it will be downloaded into the "cache" directory (relative to the Ant build file's ${basedir}). However, if the file is already in that cache directory, then that file will be used without connecting to the remote repository.
<libraryDef>
    <mavenrepository remote="http://files.myintranet.com/maven/repository,
        http://www.ibiblio.org/maven" />
    
    <library>
        <lib-entry groupid="log4j" artifactid="log4j" version="SNAPSHOT" />
    </library>
</libraryDef>
Same as above, but uses the local user's cache directory (${user.home}/.maven/repository), and also tries to download the files from a locally mirrored repository at http://files.myintranet.com/maven/repository before looking at the default internet ibiblio site.


Document version $Revision: 1.11 $ $Date: 2005/10/27 16:30:56 $

SourceForge Logo
Copyright © 2004-2006, The Antlion Project