@@ -0,0 +1,2309 @@
+package pl.openrest.dto.mappers.generator;%0A%0Aimport java.io.File;%0Aimport java.net.MalformedURLException;%0Aimport java.net.URL;%0Aimport java.net.URLClassLoader;%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Aimport lombok.NonNull;%0A%0Aimport org.apache.maven.artifact.DependencyResolutionRequiredException;%0Aimport org.apache.maven.plugin.MojoExecutionException;%0Aimport org.apache.maven.project.MavenProject;%0Aimport org.reflections.Reflections;%0Aimport org.reflections.scanners.Scanner;%0Aimport org.reflections.util.ConfigurationBuilder;%0A%0Aimport pl.openrest.generator.commons.ReflectionsFactory;%0A%0Apublic class ProjectClassPathAwareReflectionsRepository implements ReflectionsFactory %7B%0A%0A    private final List%3CURL%3E projectClassPathURLs;%0A    private final URLClassLoader projectClassLoader;%0A%0A    public ProjectClassPathAwareReflectionsRepository(@NonNull MavenProject mavenProject) throws MojoExecutionException %7B%0A        try %7B%0A            this.projectClassPathURLs = getProjectClassPathURLs(mavenProject.getRuntimeClasspathElements());%0A            this.projectClassLoader = new URLClassLoader(projectClassPathURLs.toArray(new URL%5B0%5D), this.getClass().getClassLoader());%0A        %7D catch (DependencyResolutionRequiredException e) %7B%0A            throw new MojoExecutionException(%22Cannot get RuntimeClasspathElements%22, e);%0A        %7D%0A    %7D%0A%0A    @Override%0A    public Reflections create(List%3CString%3E packages, List%3CScanner%3E scanners) %7B%0A        Reflections reflections = new Reflections(new ConfigurationBuilder().forPackages(packages.toArray(new String%5Bpackages.size()%5D))%0A                .addScanners(scanners.toArray(new Scanner%5Bscanners.size()%5D)).addUrls(projectClassPathURLs)%0A                .addClassLoader(projectClassLoader));%0A        return reflections;%0A    %7D%0A%0A    private List%3CURL%3E getProjectClassPathURLs(List%3CString%3E classPathElements) throws MojoExecutionException %7B%0A        List%3CURL%3E projectClasspathList = new ArrayList%3CURL%3E();%0A        for (String element : classPathElements) %7B%0A            try %7B%0A                projectClasspathList.add(new File(element).toURI().toURL());%0A            %7D catch (MalformedURLException e) %7B%0A                throw new MojoExecutionException(String.format(%22Error occured parsing string %25s to URL%22, element), e);%0A            %7D%0A        %7D%0A        return projectClasspathList;%0A    %7D%0A%7D%0A

Create ProjectClassPathAwareReflectionsRepository that creates Reflections that are aware of ProjectClasspath