1 20 package net.sf.clirr.maven; 21 22 import java.io.File ; 23 import java.util.List ; 24 25 import org.apache.maven.jelly.MavenJellyContext; 26 import org.apache.maven.project.Version; 27 import org.apache.maven.util.HttpUtils; 28 29 30 35 public class ClirrUtils 36 { 37 44 public static String getLatestVersion(List versions) 45 { 46 String result = null; 47 48 if (!versions.isEmpty()) 49 { 50 int pos = versions.size(); 51 while (pos > 0) 52 { 53 Version latestVersion = 54 (Version) versions.get(pos - 1); 55 56 if (!latestVersion.getTag().equalsIgnoreCase("HEAD")) 58 { 59 result = latestVersion.getId(); 60 break; 61 } 62 else 63 { 64 pos = pos - 1; 65 } 66 } 67 } 68 69 return result; 70 } 71 72 75 public static void getBaselineJar(MavenJellyContext context) 76 throws Exception 77 { 78 String targetFileName = (String ) context.getVariable("clirr.baseline.destination"); 79 File targetFile = new File (targetFileName); 80 HttpUtils.getFile( 81 (String ) context.getVariable("clirr.baseline.url"), 82 targetFile, 83 false, 84 true, 85 null, 86 null, 87 null, 88 null); 89 } 90 91 } 92 | Popular Tags |