Search in sources :

Example 16 with CvsScmProviderRepository

use of org.apache.maven.scm.provider.cvslib.repository.CvsScmProviderRepository in project maven-scm by apache.

the class CvsLoginCommand method executeLoginCommand.

/**
 * {@inheritDoc}
 */
public LoginScmResult executeLoginCommand(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
    CvsScmProviderRepository repo = (CvsScmProviderRepository) repository;
    if (!"pserver".equals(repo.getTransport())) {
        return new LoginScmResult(null, "The cvs login ignored for " + repo.getTransport() + ".", "", true);
    } else if (isCvsNT()) {
        // We don't continue becauseCVSNT doesn't use .cvspass
        return new LoginScmResult(null, "The cvs login ignored for CVSNT.", "", true);
    }
    CvsPass passGenerator = new CvsPass(getLogger());
    passGenerator.setCvsroot(repo.getCvsRootForCvsPass());
    passGenerator.setPassword(repo.getPassword());
    try {
        passGenerator.execute();
    } catch (IOException e) {
        throw new ScmException("Error while executing cvs login command.", e);
    }
    return new LoginScmResult(null, "The cvs command succeed.", "", true);
}
Also used : ScmException(org.apache.maven.scm.ScmException) CvsScmProviderRepository(org.apache.maven.scm.provider.cvslib.repository.CvsScmProviderRepository) LoginScmResult(org.apache.maven.scm.command.login.LoginScmResult) IOException(java.io.IOException)

Example 17 with CvsScmProviderRepository

use of org.apache.maven.scm.provider.cvslib.repository.CvsScmProviderRepository in project maven-plugins by apache.

the class DoapMojo method writeSourceRepository.

/**
 * Write a DOAP repository, for instance:
 * <p/>
 * <pre>
 *   &lt;repository&gt;
 *     &lt;SVNRepository&gt;
 *       &lt;location rdf:resource="http://svn.apache.org/repos/asf/maven/components/trunk/"/&gt;
 *       &lt;browse rdf:resource="http://svn.apache.org/viewcvs.cgi/maven/components/trunk/"/&gt;
 *     &lt;/SVNRepository&gt;
 *   &lt;/repository&gt;
 * </pre>
 *
 * @param writer     not null
 * @param project    the Maven project, not null
 * @param connection not null
 * @see <a href="http://usefulinc.com/ns/doap#Repository">http://usefulinc.com/ns/doap#Repository</a>
 * @see <a href="http://usefulinc.com/ns/doap#CVSRepository">http://usefulinc.com/ns/doap#CVSRepository</a>
 * @see <a href="http://usefulinc.com/ns/doap#SVNRepository">http://usefulinc.com/ns/doap#SVNRepository</a>
 */
private void writeSourceRepository(XMLWriter writer, MavenProject project, String connection) {
    ScmRepository repository = getScmRepository(connection);
    DoapUtil.writeStartElement(writer, doapOptions.getXmlnsPrefix(), "repository");
    if (isScmSystem(repository, "cvs")) {
        DoapUtil.writeStartElement(writer, doapOptions.getXmlnsPrefix(), "CVSRepository");
        CvsScmProviderRepository cvsRepo = (CvsScmProviderRepository) repository.getProviderRepository();
        DoapUtil.writeElement(writer, doapOptions.getXmlnsPrefix(), "anon-root", cvsRepo.getCvsRoot());
        DoapUtil.writeElement(writer, doapOptions.getXmlnsPrefix(), "module", cvsRepo.getModule());
    } else if (isScmSystem(repository, "svn")) {
        DoapUtil.writeStartElement(writer, doapOptions.getXmlnsPrefix(), "SVNRepository");
        SvnScmProviderRepository svnRepo = (SvnScmProviderRepository) repository.getProviderRepository();
        DoapUtil.writeRdfResourceElement(writer, doapOptions.getXmlnsPrefix(), "location", svnRepo.getUrl());
    } else {
        /*
             * Supported DOAP repositories actually unsupported by SCM: BitKeeper
             * (http://usefulinc.com/ns/doap#BKRepository) Arch (http://usefulinc.com/ns/doap#ArchRepository) Other SCM
             * repos are unsupported by DOAP.
             */
        DoapUtil.writeStartElement(writer, doapOptions.getXmlnsPrefix(), "Repository");
        if (connection.length() < 4) {
            throw new IllegalArgumentException("The source repository connection is too short.");
        }
        DoapUtil.writeRdfResourceElement(writer, doapOptions.getXmlnsPrefix(), "location", connection.substring(4));
    }
    DoapUtil.writeRdfResourceElement(writer, doapOptions.getXmlnsPrefix(), "browse", project.getScm().getUrl());
    // CVSRepository || SVNRepository || Repository
    writer.endElement();
    // repository
    writer.endElement();
}
Also used : ScmRepository(org.apache.maven.scm.repository.ScmRepository) CvsScmProviderRepository(org.apache.maven.scm.provider.cvslib.repository.CvsScmProviderRepository) SvnScmProviderRepository(org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository)

Aggregations

CvsScmProviderRepository (org.apache.maven.scm.provider.cvslib.repository.CvsScmProviderRepository)17 Commandline (org.codehaus.plexus.util.cli.Commandline)13 File (java.io.File)6 IOException (java.io.IOException)4 ScmException (org.apache.maven.scm.ScmException)3 ArrayList (java.util.ArrayList)2 ScmFile (org.apache.maven.scm.ScmFile)2 SimpleDateFormat (java.text.SimpleDateFormat)1 ScmVersion (org.apache.maven.scm.ScmVersion)1 CheckInScmResult (org.apache.maven.scm.command.checkin.CheckInScmResult)1 LoginScmResult (org.apache.maven.scm.command.login.LoginScmResult)1 SvnScmProviderRepository (org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository)1 Settings (org.apache.maven.scm.providers.cvslib.settings.Settings)1 ScmRepository (org.apache.maven.scm.repository.ScmRepository)1 ScmRepositoryException (org.apache.maven.scm.repository.ScmRepositoryException)1