private FixedIndexedRepo loadRepo(List<String> uris) throws IOException, URISyntaxException { FixedIndexedRepo repo = new FixedIndexedRepo(); StringBuilder sb = new StringBuilder(); for (Iterator<String> iter = uris.iterator(); iter.hasNext(); ) { sb.append(iter.next()); if (iter.hasNext()) sb.append(','); } repo.setLocations(sb.toString()); return repo; }
private static String getLatestRemoteBladeCLIJar() { _settingsDir.mkdirs(); repoCache.mkdirs(); Processor reporter = new Processor(); FixedIndexedRepo repo = new FixedIndexedRepo(); Map<String, String> props = new HashMap<String, String>(); props.put("name", "index1"); props.put("locations", getRepoURL() + "index.xml.gz"); props.put(FixedIndexedRepo.PROP_CACHE, repoCache.getAbsolutePath()); repo.setProperties(props); repo.setReporter(reporter); try { File[] files = repo.get("com.liferay.blade.cli", "[2,3)"); File cliJar = files[0]; try (Jar cliJarJar = new Jar(cliJar); Jar localJar = new Jar(getLocalCopy())) { Version cliJarVersion = new Version(cliJarJar.getVersion()); Version localCopyVersion = new Version(localJar.getVersion()); if (cliJarVersion.compareTo(localCopyVersion) >= 0) { cachedBladeCLIPath = new Path(cliJar.getCanonicalPath()); } else { return null; } } return cliJar.getName(); } catch (Exception e) { return null; } }