Example #1
0
 @Override
 public String toPath(Artifact artifact) {
   Map<String, Object> attributes = toAttributes(artifact);
   if (attributes.containsKey("timestamp")) {
     final Object revisionValue = attributes.get("timestamp");
     String pattern = getPattern().replaceFirst("\\-\\[revision\\]", "-" + revisionValue);
     return IvyPatternHelper.substituteTokens(pattern, attributes);
   }
   return IvyPatternHelper.substituteTokens(getPattern(), attributes);
 }
Example #2
0
 @Override
 public String toModulePath(Artifact artifact) {
   String pattern = getPattern();
   if (!pattern.endsWith(MavenPattern.M2_PATTERN)) {
     throw new UnsupportedOperationException("Cannot locate module for non-maven layout.");
   }
   String metaDataPattern =
       pattern.substring(0, pattern.length() - MavenPattern.M2_PER_MODULE_PATTERN.length() - 1);
   return IvyPatternHelper.substituteTokens(metaDataPattern, toAttributes(artifact));
 }