DefaultRepositorySystemSession session = new MavenRepositorySystemSession();
session.setOffline(false);
session.setProxySelector(MavenUtils.getProxySelector(proxyProtocol, proxyHost, proxyPort, proxyNonProxyHosts, proxyUsername, proxyPassword));
session.setMirrorSelector(MavenUtils.getMirrorSelector());
session.setAuthenticationSelector(MavenUtils.getAuthSelector());
session.setCache(new DefaultRepositoryCache());
session.setUpdatePolicy(updatePolicy);
session.setChecksumPolicy(checksumPolicy);
LocalRepository localRepo = new LocalRepository(localRepository);
session.setLocalRepositoryManager(system.newLocalRepositoryManager(localRepo));
return session;