if (repositorySystem == null) {
System.out.println("Couldn't initialize local maven repository system.");
System.exit(0);
} else {
// Setup the repository system session based upon the current maven settings.xml.
final DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
final LocalRepository localRepo = new LocalRepository(directory);
RemoteRepository.Builder repoBuilder = new RemoteRepository.Builder("repo", "default", url);
if ((username != null) && (password != null)) {
final Authentication authentication = new AuthenticationBuilder().addUsername(
username).addPassword(password).build();
repoBuilder.setAuthentication(authentication);
}
final RemoteRepository remoteRepository = repoBuilder.build();
session.setLocalRepositoryManager(repositorySystem.newLocalRepositoryManager(session, localRepo));
// Process all content of the mavenizer target directory.
final File rootDir = new File(directory);
processDir(rootDir, repositorySystem, session, remoteRepository);
}