Description
When I use the following ant task, the [conf] token is always default.
<ivy:artifactproperty conf="src" name="[organisation].[module].[artifact]"
value="/[conf]/[artifact]-[revision].[ext]"/>
The problem is in the way IvyArtifactProperty is calling IvyPatternHelper.substitute.
public static String substitute(String pattern, Artifact artifact)
{ return substitute(pattern, artifact.getModuleRevisionId().getOrganisation(), artifact.getModuleRevisionId().getName(), artifact.getModuleRevisionId().getRevision(), artifact.getName(), artifact.getType(), artifact.getExt(), null); }The last parameter of null causes the [conf] token to be substituted with default.
The following change to IvyArtifactProperty.execute() fixed this bug.
XmlReportParser parser = new XmlReportParser();
String[] confs = splitConfs(_conf);
Collection all = new HashSet();
for (int i = 0; i < confs.length; i++) {
Artifact[] artifacts = parser.getArtifacts(new ModuleId(_organisation, _module), confs[i], _cache);
//all.addAll(Arrays.asList(artifacts));
for (int j = 0; j < artifacts.length; j++)
}
Including the following addition to IvyPatternHelper
public static String substitute(String pattern, Artifact artifact, String conf)
{ return substitute(pattern, artifact.getModuleRevisionId().getOrganisation(), artifact.getModuleRevisionId().getName(), artifact.getModuleRevisionId().getRevision(), artifact.getName(), artifact.getType(), artifact.getExt(), conf); }