Search in sources :

Example 1 with ScmProviderRepositoryWithHost

use of org.apache.maven.scm.provider.ScmProviderRepositoryWithHost in project maven-plugins by apache.

the class ChangeLogReport method getScmRepository.

public ScmRepository getScmRepository() throws ScmException {
    ScmRepository repository;
    try {
        repository = manager.makeScmRepository(getConnection());
        ScmProviderRepository providerRepo = repository.getProviderRepository();
        if (!StringUtils.isEmpty(username)) {
            providerRepo.setUser(username);
        }
        if (!StringUtils.isEmpty(password)) {
            providerRepo.setPassword(password);
        }
        if (repository.getProviderRepository() instanceof ScmProviderRepositoryWithHost) {
            ScmProviderRepositoryWithHost repo = (ScmProviderRepositoryWithHost) repository.getProviderRepository();
            loadInfosFromSettings(repo);
            if (!StringUtils.isEmpty(username)) {
                repo.setUser(username);
            }
            if (!StringUtils.isEmpty(password)) {
                repo.setPassword(password);
            }
            if (!StringUtils.isEmpty(privateKey)) {
                repo.setPrivateKey(privateKey);
            }
            if (!StringUtils.isEmpty(passphrase)) {
                repo.setPassphrase(passphrase);
            }
        }
        if (!StringUtils.isEmpty(tagBase) && repository.getProvider().equals("svn")) {
            SvnScmProviderRepository svnRepo = (SvnScmProviderRepository) repository.getProviderRepository();
            svnRepo.setTagBase(tagBase);
        }
    } catch (Exception e) {
        throw new ScmException("Can't load the scm provider.", e);
    }
    return repository;
}
Also used : ScmRepository(org.apache.maven.scm.repository.ScmRepository) ScmException(org.apache.maven.scm.ScmException) ScmProviderRepositoryWithHost(org.apache.maven.scm.provider.ScmProviderRepositoryWithHost) SvnScmProviderRepository(org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository) ScmProviderRepository(org.apache.maven.scm.provider.ScmProviderRepository) SvnScmProviderRepository(org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository) ParseException(java.text.ParseException) FileNotFoundException(java.io.FileNotFoundException) ScmException(org.apache.maven.scm.ScmException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) MavenReportException(org.apache.maven.reporting.MavenReportException) IOException(java.io.IOException) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException)

Aggregations

FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 ParseException (java.text.ParseException)1 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1 MavenReportException (org.apache.maven.reporting.MavenReportException)1 ScmException (org.apache.maven.scm.ScmException)1 ScmProviderRepository (org.apache.maven.scm.provider.ScmProviderRepository)1 ScmProviderRepositoryWithHost (org.apache.maven.scm.provider.ScmProviderRepositoryWithHost)1 SvnScmProviderRepository (org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository)1 ScmRepository (org.apache.maven.scm.repository.ScmRepository)1