Source:
public ProjectBuildingRequest getBuildingRequest(final boolean offline) { ClassLoader cl = Thread.currentThread().getContextClassLoader(); try { Settings settings = getSettings(); MavenExecutionRequest executionRequest = new DefaultMavenExecutionRequest(); lookup(MavenExecutionRequestPopulator.class).populateFromSettings(executionRequest, getSettings()); lookup(MavenExecutionRequestPopulator.class).populateDefaults(executionRequest); request = executionRequest.getProjectBuildingRequest(); ArtifactRepository localRepository = RepositoryUtils.toArtifactRepository("local", new File(settings.getLocalRepository()).toURI().toURL().toString(), null, true, true); request.setLocalRepository(localRepository); List<ArtifactRepository> settingsRepos = request.getRemoteRepositories(); request.setRemoteRepositories(settingsRepos); request.setSystemProperties(System.getProperties()); MavenRepositorySystemSession repositorySession = new MavenRepositorySystemSession(); Proxy activeProxy = settings.getActiveProxy(); if (activeProxy != null) { DefaultProxySelector dps = new DefaultProxySelector(); dps.add(RepositoryUtils.convertFromMavenProxy(activeProxy), activeProxy.getNonProxyHosts()); repositorySession.setProxySelector(dps); } repositorySession.setLocalRepositoryManager(new SimpleLocalRepositoryManager(settings.getLocalRepository())); repositorySession.setOffline(offline); List<Mirror> mirrors = executionRequest.getMirrors(); if (mirrors != null) { DefaultMirrorSelector mirrorSelector = new DefaultMirrorSelector(); for (Mirror mirror : mirrors) { mirrorSelector.add(mirror.getId(), mirror.getUrl(), mirror.getLayout(), false, mirror.getMirrorOf(), mirror.getMirrorOfLayouts()); } repositorySession.setMirrorSelector(mirrorSelector); } request.setRepositorySession(repositorySession); request.setProcessPlugins(false); request.setResolveDependencies(false); return request; } catch (Exception e) { throw new ProjectModelException( "Could not create Maven project building request", e); } finally { Thread.currentThread().setContextClassLoader(cl); } }

Target:
public ProjectBuildingRequest getBuildingRequest(final boolean offline) { ClassLoader cl = Thread.currentThread().getContextClassLoader(); try { Settings settings = getSettings(); MavenExecutionRequest executionRequest = new DefaultMavenExecutionRequest(); lookup(MavenExecutionRequestPopulator.class).populateFromSettings(executionRequest, getSettings()); lookup(MavenExecutionRequestPopulator.class).populateDefaults(executionRequest); request = executionRequest.getProjectBuildingRequest(); ArtifactRepository localRepository = RepositoryUtils.toArtifactRepository("local", new File(settings.getLocalRepository()).toURI().toURL().toString(), null, true, true); request.setLocalRepository(localRepository); request.setSystemProperties(System.getProperties()); MavenRepositorySystemSession repositorySession = new MavenRepositorySystemSession(); Proxy activeProxy = settings.getActiveProxy(); if (activeProxy != null) { DefaultProxySelector dps = new DefaultProxySelector(); dps.add(RepositoryUtils.convertFromMavenProxy(activeProxy), activeProxy.getNonProxyHosts()); repositorySession.setProxySelector(dps); } repositorySession.setLocalRepositoryManager(new SimpleLocalRepositoryManager(settings.getLocalRepository())); repositorySession.setOffline(offline); List<Mirror> mirrors = executionRequest.getMirrors(); if (mirrors != null) { DefaultMirrorSelector mirrorSelector = new DefaultMirrorSelector(); for (Mirror mirror : mirrors) { mirrorSelector.add(mirror.getId(), mirror.getUrl(), mirror.getLayout(), false, mirror.getMirrorOf(), mirror.getMirrorOfLayouts()); } repositorySession.setMirrorSelector(mirrorSelector); } request.setRepositorySession(repositorySession); request.setProcessPlugins(false); request.setResolveDependencies(false); return request; } catch (Exception e) { throw new ProjectModelException( "Could not create Maven project building request", e); } finally { Thread.currentThread().setContextClassLoader(cl); } }