Skip to content

Commit

Permalink
# bug with missing generator jars
Browse files Browse the repository at this point in the history
  • Loading branch information
Frisch12 committed Apr 10, 2018
1 parent dc6f939 commit 71562d7
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,21 @@ public void apply(Project project) {
project.getTasks().create(taskName, t -> {
project.getTasks().getByName(s.getCompileJavaTaskName()).dependsOn(t.getPath());
t.doLast(t2 -> {

URL[] urls = codeGenerator.getGeneratorJars().stream().map(c -> {
try {
File file = new File(project.getProjectDir().getAbsolutePath(), c.getPath());
if(file.exists())
File file;
if (!c.getPath().startsWith("/"))
file = new File(project.getProjectDir().getAbsolutePath(), c.getPath());
else
file = c;
if (file.exists())
return file.toURI().toURL();
return null;
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
}).filter(Objects::nonNull).collect(Collectors.toList()).toArray(new URL[codeGenerator.getGeneratorJars().size()]);
}).filter(Objects::nonNull).toArray(URL[]::new);

ClassLoader loader = new URLClassLoader(urls, Thread.currentThread().getContextClassLoader());
Thread.currentThread().setContextClassLoader(loader);
Collection<URL> reflectionUrls = new ArrayList<>(ClasspathHelper.forClassLoader(loader));
Expand Down

0 comments on commit 71562d7

Please sign in to comment.