• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ScmException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.maven.scm.ScmException的典型用法代码示例。如果您正苦于以下问题:Java ScmException类的具体用法?Java ScmException怎么用?Java ScmException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ScmException类属于org.apache.maven.scm包,在下文中一共展示了ScmException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: executeStatusCommand

import org.apache.maven.scm.ScmException; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
protected StatusScmResult executeStatusCommand( ScmProviderRepository repo, ScmFileSet fileSet )
    throws ScmException
{
    if ( getLogger().isInfoEnabled() )
    {
        getLogger().info( "SVN status directory: " + fileSet.getBasedir().getAbsolutePath() );
    }

    SvnJavaScmProviderRepository javaRepo = (SvnJavaScmProviderRepository) repo;

    SvnStatusHandler handler = new SvnStatusHandler( fileSet.getBasedir() );

    try
    {
        SvnJavaUtil.status( javaRepo.getClientManager(), fileSet.getBasedir(), true, // isRecursive
                            true, // isRemote
                            handler );

        return new StatusScmResult( SvnJavaScmProvider.COMMAND_LINE, handler.getFiles() );
    }
    catch ( SVNException e )
    {
        return new StatusScmResult( SvnJavaScmProvider.COMMAND_LINE, "SVN status failed.", e.getMessage(), false );
    }
}
 
开发者ID:olamy,项目名称:maven-scm-provider-svnjava,代码行数:29,代码来源:SvnJavaStatusCommand.java


示例2: executeBlameCommand

import org.apache.maven.scm.ScmException; //导入依赖的package包/类
/**
 * @see org.apache.maven.scm.command.blame.AbstractBlameCommand#executeBlameCommand(org.apache.maven.scm.provider.ScmProviderRepository,
 *      org.apache.maven.scm.ScmFileSet, java.lang.String)
 */
@Override
public BlameScmResult executeBlameCommand( ScmProviderRepository repo, ScmFileSet workingDirectory,
                                           String filename )
    throws ScmException
{
    try
    {
        SvnJavaScmProviderRepository javaRepo = (SvnJavaScmProviderRepository) repo;
        javaRepo.getClientManager();
        AnnotationHandler handler = new AnnotationHandler();
        SvnJavaUtil.blame( javaRepo.getClientManager(), new File( workingDirectory.getBasedir(), filename ),
                           handler );
        return new BlameScmResult( "", handler.lines );
    }
    catch ( SVNException e )
    {
        throw new ScmException( e.getMessage(), e );
    }
}
 
开发者ID:olamy,项目名称:maven-scm-provider-svnjava,代码行数:24,代码来源:SvnJavaBlameCommand.java


示例3: resolveBranchOrExpression

import org.apache.maven.scm.ScmException; //导入依赖的package包/类
/**
 * Given the ScmManager for the current execution cycle, and the MavenProject structure, determine if we can
 * find a maven-provided manner of resolving the current git branch.
 *
 * @param scmManager The current maven ScmManager
 * @param project    The Current maven Project
 * @param log        A Log to write to
 * @return The current git branch name, or <code>${env.GIT_BRACH}</code> if the current git branch could not be resolved.
 * @throws ScmException
 */
public static String resolveBranchOrExpression(final ScmManager scmManager, final MavenProject project, final Log log) {
    String connectionUrl = resolveUrlOrExpression(project, log);

    // If a connectionURL other than the default expression was resolved, try to resolve the branch.
    if (!StringUtils.equals(connectionUrl, DEFAULT_URL_EXPRESSION)) {
        try {
            ScmRepository repository = scmManager.makeScmRepository(connectionUrl);
            ScmProvider provider = scmManager.getProviderByRepository(repository);

            if (GitScmProviderRepository.PROTOCOL_GIT.equals(provider.getScmType())) {
                ScmFileSet fileSet = new ScmFileSet(project.getBasedir());
                return GitBranchCommand.getCurrentBranch(new ScmLogDispatcher(), (GitScmProviderRepository) repository.getProviderRepository(), fileSet);
            } else {
                log.warn("Project SCM defines a non-git SCM provider. Falling back to  variable resolution.");
            }
        } catch (ScmException se) {
            log.warn("Unable to resolve Git Branch from Project SCM definition.", se);
        }
    }

    log.debug("Git branch unresolvable from Project SCM definition, defaulting to " + DEFAULT_BRANCH_EXPRESSION);
    return DEFAULT_BRANCH_EXPRESSION;
}
 
开发者ID:egineering-llc,项目名称:gitflow-helper-maven-plugin,代码行数:34,代码来源:ScmUtils.java


示例4: getRevision

import org.apache.maven.scm.ScmException; //导入依赖的package包/类
public String getRevision()
    throws MojoExecutionException
{
    try
    {
        return this.getScmRevision();
    }
    catch ( ScmException e )
    {
        if ( !StringUtils.isEmpty( revisionOnScmFailure ) )
        {
            getLog().warn( "Cannot get the revision information from the scm repository, proceeding with "
                + "revision of " + revisionOnScmFailure + " : \n" + e.getLocalizedMessage() );

            return revisionOnScmFailure;
        }

        throw new MojoExecutionException( "Cannot get the revision information from the scm repository : \n"
            + e.getLocalizedMessage(), e );

    }
}
 
开发者ID:mojohaus,项目名称:buildnumber-maven-plugin,代码行数:23,代码来源:CreateMetadataMojo.java


示例5: getScmRepository

import org.apache.maven.scm.ScmException; //导入依赖的package包/类
protected ScmRepository getScmRepository()
    throws ScmException
{
    ScmRepository repository = scmManager.makeScmRepository( !StringUtils.isBlank( this.scmConnectionUrl )
                    ? scmConnectionUrl : scmDeveloperConnectionUrl );

    ScmProviderRepository scmRepo = repository.getProviderRepository();

    if ( scmRepo instanceof ScmProviderRepositoryWithHost )
    {
        loadInfosFromSettings( (ScmProviderRepositoryWithHost) scmRepo );
    }

    setPasswordIfNotEmpty( scmRepo, password );

    setUserIfNotEmpty( scmRepo, username );

    return repository;
}
 
开发者ID:mojohaus,项目名称:buildnumber-maven-plugin,代码行数:20,代码来源:AbstractScmMojo.java


示例6: checkResult

import org.apache.maven.scm.ScmException; //导入依赖的package包/类
protected void checkResult( ScmResult result )
    throws ScmException
{
    if ( !result.isSuccess() )
    {
        // TODO: improve error handling
        getLog().error( "Provider message:" );

        getLog().error( result.getProviderMessage() );

        getLog().error( "Command output:" );

        getLog().error( result.getCommandOutput() );

        throw new ScmException( "Error!" );
    }
}
 
开发者ID:mojohaus,项目名称:buildnumber-maven-plugin,代码行数:18,代码来源:AbstractScmMojo.java


示例7: info

import org.apache.maven.scm.ScmException; //导入依赖的package包/类
/**
 * Get info from scm.
 *
 * @param repository
 * @param fileSet
 * @return
 * @throws ScmException
 * @todo this should be rolled into org.apache.maven.scm.provider.ScmProvider and
 *       org.apache.maven.scm.provider.svn.SvnScmProvider
 */
protected InfoScmResult info( ScmRepository repository, ScmFileSet fileSet )
    throws ScmException
{
    CommandParameters commandParameters = new CommandParameters();

    // only for Git, we will make a test for shortRevisionLength parameter
    if ( GitScmProviderRepository.PROTOCOL_GIT.equals( scmManager.getProviderByRepository( repository ).getScmType() )
        && this.shortRevisionLength > 0 )
    {
        getLog().info( "ShortRevision tag detected. The value is '" + this.shortRevisionLength + "'." );
        if ( shortRevisionLength >= 0 && shortRevisionLength < 4 )
        {
            getLog().warn( "shortRevision parameter less then 4. ShortRevisionLength is relaying on 'git rev-parese --short=LENGTH' command, accordingly to Git rev-parse specification the LENGTH value is miminum 4. " );
        }
        commandParameters.setInt( CommandParameter.SCM_SHORT_REVISION_LENGTH, this.shortRevisionLength );
    }

    if ( !StringUtils.isBlank( scmTag ) && !"HEAD".equals( scmTag ) )
    {
        commandParameters.setScmVersion( CommandParameter.SCM_VERSION, new ScmTag( scmTag ) );
    }

    return scmManager.getProviderByRepository( repository ).info( repository.getProviderRepository(), fileSet,
                                                                  commandParameters );
}
 
开发者ID:mojohaus,项目名称:buildnumber-maven-plugin,代码行数:36,代码来源:AbstractScmMojo.java


示例8: findModifiedPaths

import org.apache.maven.scm.ScmException; //导入依赖的package包/类
private Set<String> findModifiedPaths() throws MojoExecutionException {
  try {
    final ScmRepository repository = this.manager
        .makeScmRepository(getSCMConnection());
    final File scmRoot = scmRoot();
    this.getLog().info("Scm root dir is " + scmRoot);

    final Set<ScmFileStatus> statusToInclude = makeStatusSet();
    final Set<String> modifiedPaths;
    if (analyseLastCommit) {
      modifiedPaths = lastCommitChanges(statusToInclude, repository, scmRoot);
    } else if (originBranch != null && destinationBranch != null) {
      modifiedPaths = changesBetweenBranchs(originBranch, destinationBranch, statusToInclude, repository, scmRoot);
    } else {
      modifiedPaths = localChanges(statusToInclude, repository, scmRoot);
    }
    return modifiedPaths;
  } catch (final ScmException e) {
    throw new MojoExecutionException("Error while querying scm", e);
  }

}
 
开发者ID:hcoles,项目名称:pitest,代码行数:23,代码来源:ScmMojo.java


示例9: pathsAffectedByChange

import org.apache.maven.scm.ScmException; //导入依赖的package包/类
private Set<String> pathsAffectedByChange(ChangeLogScmRequest scmRequest, Set<ScmFileStatus> statusToInclude, int limit) throws ScmException {
  Set<String> affected = new LinkedHashSet<>();
  ChangeLogScmResult changeLogScmResult = this.manager.changeLog(scmRequest);
  if (changeLogScmResult.isSuccess()) {
    List<ChangeSet> changeSets = limit(changeLogScmResult.getChangeLog().getChangeSets(),limit);
    for (ChangeSet change : changeSets) {
      List<ChangeFile> files = change.getFiles();
      for (final ChangeFile changeFile : files) {
        if (statusToInclude.contains(changeFile.getAction())) {
          affected.add(changeFile.getName());
        }
      }
    }
  }
  return affected;
}
 
开发者ID:hcoles,项目名称:pitest,代码行数:17,代码来源:ScmMojo.java


示例10: cloneRepository

import org.apache.maven.scm.ScmException; //导入依赖的package包/类
public CheckOutScmResult cloneRepository(String scmUrl, String revision, String cloneTo) throws ScmException {

        File buildDir = new File(cloneTo);
        if (!buildDir.exists())
            buildDir.mkdir();

        ScmRepository repo = getScmRepository(String.format("scm:%s:%s", repositoryType.name(), scmUrl), scmManager);
        return scmManager.checkOut(repo, new ScmFileSet(buildDir), new ScmTag(revision));
    }
 
开发者ID:ahmedlawi92,项目名称:pnc-local,代码行数:10,代码来源:ScmRetriever.java


示例11: getRepositoryURL

import org.apache.maven.scm.ScmException; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
protected String getRepositoryURL( File path )
    throws ScmException
{
    try
    {
        return SVNURL.fromFile( path ).getURIEncodedPath();
    }
    catch ( SVNException e )
    {
        throw new IllegalArgumentException( e.getMessage() );
    }
}
 
开发者ID:olamy,项目名称:maven-scm-provider-svnjava,代码行数:16,代码来源:SvnJavaScmProvider.java


示例12: remoteInfo

import org.apache.maven.scm.ScmException; //导入依赖的package包/类
@Override
public RemoteInfoScmResult remoteInfo( ScmProviderRepository repository, ScmFileSet fileSet,
                                       CommandParameters parameters )
    throws ScmException
{
    return new SvnJavaRemoteInfoCommand().executeRemoteInfoCommand( repository, fileSet, parameters );
}
 
开发者ID:olamy,项目名称:maven-scm-provider-svnjava,代码行数:8,代码来源:SvnJavaScmProvider.java


示例13: executeCommand

import org.apache.maven.scm.ScmException; //导入依赖的package包/类
@Override
public ScmResult executeCommand( ScmProviderRepository repository, ScmFileSet fileSet,
                                 CommandParameters parameters )
    throws ScmException
{
    boolean recursive = parameters == null ? false : parameters.getBoolean( CommandParameter.RECURSIVE );
    ScmVersion scmVersion =
        parameters == null ? null : parameters.getScmVersion( CommandParameter.SCM_VERSION, null );
    return executeListCommand( repository, fileSet, recursive, scmVersion );
}
 
开发者ID:olamy,项目名称:maven-scm-provider-svnjava,代码行数:11,代码来源:SvnJavaListCommand.java


示例14: executeMkdirCommand

import org.apache.maven.scm.ScmException; //导入依赖的package包/类
/**
 * @see org.apache.maven.scm.command.mkdir.AbstractMkdirCommand#executeMkdirCommand(org.apache.maven.scm.provider.ScmProviderRepository, org.apache.maven.scm.ScmFileSet, java.lang.String)
 */
@Override
protected MkdirScmResult executeMkdirCommand( ScmProviderRepository repository, ScmFileSet fileSet, String message,
                                              boolean createInLocal )
    throws ScmException
{
    SvnJavaScmProviderRepository javaRepo = (SvnJavaScmProviderRepository) repository;
    Iterator<File> it = fileSet.getFileList().iterator();
    String dirPath = it.next().getPath();
    // replacing \ with / for windauze
    if ( dirPath != null && Os.isFamily( Os.FAMILY_DOS ) )
    {
        dirPath = StringUtils.replace( dirPath, "\\", "/" );
    }
    String url = javaRepo.getUrl() + "/" + dirPath;
    if ( createInLocal )
    {
        url = dirPath;
    }
    List<SVNURL> svnurls = new ArrayList<SVNURL>( 1 );
    try
    {
        svnurls.add( SVNURL.parseURIEncoded( url ) );

        SVNCommitInfo commitInfo =
            SvnJavaUtil.mkdir( javaRepo.getClientManager(), svnurls.toArray( new SVNURL[svnurls.size()] ),
                               message );
        ScmResult scmResult = new ScmResult( null, null, null, true );

        return new MkdirScmResult( Long.toString( commitInfo.getNewRevision() ), scmResult );
    }
    catch ( SVNException e )
    {
        throw new ScmException( e.getMessage(), e );
    }
}
 
开发者ID:olamy,项目名称:maven-scm-provider-svnjava,代码行数:39,代码来源:SvnJavaMkdirCommand.java


示例15: executeAddCommand

import org.apache.maven.scm.ScmException; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
protected ScmResult executeAddCommand( ScmProviderRepository repository, ScmFileSet fileSet, String message,
                                       boolean binary )
    throws ScmException
{
    CommandParameters commandParameters = new CommandParameters();
    commandParameters.setString( CommandParameter.MESSAGE, message );
    return executeCommand( repository, fileSet, commandParameters );
}
 
开发者ID:olamy,项目名称:maven-scm-provider-svnjava,代码行数:12,代码来源:SvnJavaAddCommand.java


示例16: executeChangeLogCommand

import org.apache.maven.scm.ScmException; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
protected ChangeLogScmResult executeChangeLogCommand( ScmProviderRepository repository, ScmFileSet fileSet,
                                                      ScmVersion startVersion, ScmVersion endVersion,
                                                      String datePattern )
    throws ScmException
{
    throw new UnsupportedOperationException( "executeChangeLogCommand( ScmProviderRepository repository, "
                                                 + "ScmFileSet fileSet, ScmVersion startVersion, ScmVersion endVersion, String datePattern ) is not "
                                                 + "implemented" );
}
 
开发者ID:olamy,项目名称:maven-scm-provider-svnjava,代码行数:13,代码来源:SvnJavaChangeLogCommand.java


示例17: executeRemoveCommand

import org.apache.maven.scm.ScmException; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
protected ScmResult executeRemoveCommand( ScmProviderRepository repo, ScmFileSet fileSet, String message )
    throws ScmException
{
    if ( fileSet.getFileList().isEmpty() )
    {
        throw new ScmException( "You must provide at least one file/directory to remove" );
    }

    if ( getLogger().isInfoEnabled() )
    {
        getLogger().info( "SVN remove working directory: " + fileSet.getBasedir().getAbsolutePath() );
    }

    SvnJavaScmProviderRepository javaRepo = (SvnJavaScmProviderRepository) repo;

    ScmFileEventHandler handler = new ScmFileEventHandler( getLogger(), fileSet.getBasedir() );

    javaRepo.getClientManager().getWCClient().setEventHandler( handler );

    try
    {
        SvnJavaUtil.delete( javaRepo.getClientManager(), fileSet, true );

        return new RemoveScmResult( SvnJavaScmProvider.COMMAND_LINE, handler.getFiles() );
    }
    catch ( SVNException e )
    {
        return new RemoveScmResult( SvnJavaScmProvider.COMMAND_LINE, "SVN remove failed.", e.getMessage(), false );
    }
    finally
    {
        javaRepo.getClientManager().getWCClient().setEventHandler( null );
    }
}
 
开发者ID:olamy,项目名称:maven-scm-provider-svnjava,代码行数:38,代码来源:SvnJavaRemoveCommand.java


示例18: remoteUrlExist

import org.apache.maven.scm.ScmException; //导入依赖的package包/类
public boolean remoteUrlExist( ScmProviderRepository repository, CommandParameters parameters )
    throws ScmException
{
    SvnJavaScmProviderRepository javaRepo = (SvnJavaScmProviderRepository) repository;

    String url = ( (SvnScmProviderRepository) repository ).getUrl();

    try
    {

        javaRepo.getClientManager().getWCClient().doInfo( SVNURL.parseURIEncoded( url ), SVNRevision.HEAD,
                                                          SVNRevision.HEAD, SVNDepth.EMPTY, new ISVNInfoHandler()
        {
            public void handleInfo( SVNInfo svnInfo )
                throws SVNException
            {
                svnInfo.getAuthor();
            }
        } );
    }
    catch ( SVNException e )
    {
        if ( e.getMessage().indexOf( "E170000" ) > -1 )
        {
            return false;
        }
        throw new ScmException( e.getMessage(), e );
    }
    return true;
}
 
开发者ID:olamy,项目名称:maven-scm-provider-svnjava,代码行数:31,代码来源:SvnJavaRemoteInfoCommand.java


示例19: executeBranchCommand

import org.apache.maven.scm.ScmException; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public ScmResult executeBranchCommand( ScmProviderRepository repo, ScmFileSet fileSet, String branch,
                                       String message )
    throws ScmException
{
    ScmBranchParameters scmBranchParameters = new ScmBranchParameters( message );
    return executeBranchCommand( repo, fileSet, branch, scmBranchParameters );
}
 
开发者ID:olamy,项目名称:maven-scm-provider-svnjava,代码行数:11,代码来源:SvnJavaBranchCommand.java


示例20: doLocalModificationExist

import org.apache.maven.scm.ScmException; //导入依赖的package包/类
private boolean doLocalModificationExist( StringBuilder message )
    throws MojoExecutionException
{
    boolean result = false;

    getLog().debug( "Verifying there are no local modifications ..." );

    List<ScmFile> changedFiles;

    try
    {
        changedFiles = getStatus();
    }
    catch ( ScmException e )
    {
        throw new MojoExecutionException( "An error has occurred while checking scm status.", e );
    }

    if ( !changedFiles.isEmpty() )
    {
        for ( ScmFile file : changedFiles )
        {
            message.append( file.toString() );

            message.append( System.lineSeparator() );
        }

        result = true;
    }

    return result;
}
 
开发者ID:mojohaus,项目名称:buildnumber-maven-plugin,代码行数:33,代码来源:CreateMojo.java



注:本文中的org.apache.maven.scm.ScmException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PluginClassLoader类代码示例发布时间:2022-05-22
下一篇:
Java NextAction类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap