Created
January 4, 2018 11:20
-
-
Save jirkapenzes/44b27a6daf6e5b8dda887fee5a58d0f1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aether aether = Aether.builder() | |
.setLocalRepo(temp.newFolder().getPath()) | |
.addRemoteRepo("maven-central", "http://repo1.maven.org/maven2").build(); | |
List<Artifact> dependencies = aether.resolveDependencies(new DefaultArtifact("org.elasticsearch:elasticsearch:5.5.2")); | |
List<URL> urls = new ArrayList<>(); | |
for (Artifact artifact : dependencies) { | |
URL url = new URL(new URL("file:"), artifact.getFile().getAbsolutePath()); | |
urls.add(url); | |
} | |
ClassLoader classLoader = URLClassLoader.newInstance(urls.toArray(new URL[0]), classLoader); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment