The RegexpTokenFormatter is an alternative to the default Antlion
formatter. It allows for using a matched regular expression based on an
attribute's value.
Here's an example:
|
|
|
|
<repository basedir="${lib}">
<format text="[groupid,commons-(.*),$1]/[groupid]-[version].jar" />
</repository>
:
<libraryDef policyRef="track">
<lib-entry groupid="commons-lang" version="2.1"/>
</library>
|
|
|
|
|
Here, the groupid attribute value ("commons-lang") is checked
against the regular expression commons-(.*) , and the final value
used is the match on .* . So, the repository will
check this entry for the file ${lib}/lang/commons-lang-2.1.jar .
At the moment, there is no way to escape the end-token character in the
token text. This means that if you want to use a regular expression like
t-([^\.]*) , you would need to change the end-token character
using a format statement like:
|
|
|
|
<format text="@groupid,t-([^\.]*),$1@.@type@"
startToken="@" endToken="@" />
|
|
|
|
|
|