org.apache.maven.continuum.model.project.Project.getScmUrl()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(10.2k)|赞(0)|评价(0)|浏览(144)

本文整理了Java中org.apache.maven.continuum.model.project.Project.getScmUrl()方法的一些代码示例,展示了Project.getScmUrl()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Project.getScmUrl()方法的具体详情如下:
包路径:org.apache.maven.continuum.model.project.Project
类名称:Project
方法名:getScmUrl

Project.getScmUrl介绍

[英]Get null
[中]获取空值

代码示例

代码示例来源:origin: org.apache.continuum/continuum-core

private String getScmRootUrl( List<Project> projects )
{
  String scmRootUrl = "";
  for ( Project project : projects )
  {
    String scmUrl = project.getScmUrl();
    scmRootUrl = getCommonPath( scmUrl, scmRootUrl );
  }
  return scmRootUrl;
}

代码示例来源:origin: org.apache.continuum/continuum-core

private boolean pomUpdated( String buildFile, ScmResult scmResult, Project project )
{
  String filename = project.getScmUrl() + "/" + buildFile;
  for ( Iterator changeIt = scmResult.getChanges().listIterator(); changeIt.hasNext(); )
  {
    ChangeSet change = (ChangeSet) changeIt.next();
    for ( Iterator fileIt = change.getFiles().listIterator(); fileIt.hasNext(); )
    {
      ChangeFile changeFile = (ChangeFile) fileIt.next();
      if ( filename.endsWith( changeFile.getName() ) )
      {
        return true;
      }
    }
  }
  return false;
}

代码示例来源:origin: org.apache.continuum/continuum-core

public ProjectScmRoot getProjectScmRootByProject( int projectId )
  throws ContinuumException
{
  Project project = getProject( projectId );
  ProjectGroup group = getProjectGroupByProjectId( projectId );
  List<ProjectScmRoot> scmRoots = getProjectScmRootByProjectGroup( group.getId() );
  for ( ProjectScmRoot scmRoot : scmRoots )
  {
    if ( project.getScmUrl() != null && project.getScmUrl().startsWith( scmRoot.getScmRootAddress() ) )
    {
      return scmRoot;
    }
  }
  return null;
}

代码示例来源:origin: org.apache.continuum/continuum-core

private Map createProjectMap( Project project )
{
  Map<String, Object> map = new HashMap<String, Object>();
  map.put( DistributedReleaseUtil.KEY_PROJECT_ID, project.getId() );
  map.put( DistributedReleaseUtil.KEY_GROUP_ID, project.getGroupId() );
  map.put( DistributedReleaseUtil.KEY_ARTIFACT_ID, project.getArtifactId() );
  map.put( DistributedReleaseUtil.KEY_SCM_URL, project.getScmUrl() );
  if ( project.getProjectGroup().getLocalRepository() != null )
  {
    map.put( DistributedReleaseUtil.KEY_LOCAL_REPOSITORY_NAME,
         project.getProjectGroup().getLocalRepository().getName() );
  }
  return map;
}

代码示例来源:origin: org.apache.continuum/continuum-core

private void createProjectScmRootForProjectGroup( ProjectGroup projectGroup )
  throws ContinuumException
{
  List<Project> projectsList;
  projectsList = getProjectsInBuildOrder( projectDao.getProjectsWithDependenciesByGroupId(
    projectGroup.getId() ) );
  List<ProjectScmRoot> scmRoots = getProjectScmRootByProjectGroup( projectGroup.getId() );
  String url = "";
  for ( Project project : projectsList )
  {
    boolean found = false;
    if ( StringUtils.isEmpty( url ) || !project.getScmUrl().startsWith( url ) )
    {
      // this is a root project or the project is part of a flat multi module
      url = project.getScmUrl();
      //createProjectScmRoot( projectGroup, url );
      for ( ProjectScmRoot scmRoot : scmRoots )
      {
        if ( url.startsWith( scmRoot.getScmRootAddress() ) )
        {
          found = true;
        }
      }
      if ( !found )
      {
        createProjectScmRoot( projectGroup, url );
      }
    }
  }
}

代码示例来源:origin: org.apache.continuum/continuum-buildagent-core

private ContinuumScmConfiguration createScmConfiguration( Project project, File workingDirectory,
                             String scmUserName, String scmPassword )
{
  ContinuumScmConfiguration config = new ContinuumScmConfiguration();
  // CONTINUUM-2628
  config = ContinuumScmUtils.setSCMCredentialsforSSH( config, project.getScmUrl(), scmUserName, scmPassword );
  config.setUrl( project.getScmUrl() );
  config.setUseCredentialsCache( project.isScmUseCache() );
  config.setWorkingDirectory( workingDirectory );
  config.setTag( project.getScmTag() );
  return config;
}

代码示例来源:origin: org.apache.continuum/continuum-core

private void updateProjectScmRoot( ProjectScmRoot oldScmRoot, Project project )
  throws ContinuumException
{
  try
  {
    removeProjectScmRoot( oldScmRoot );
    ProjectScmRoot scmRoot = projectScmRootDao.getProjectScmRootByProjectGroupAndScmRootAddress(
      project.getProjectGroup().getId(), project.getScmUrl() );
    if ( scmRoot == null )
    {
      ProjectScmRoot newScmRoot = new ProjectScmRoot();
      if ( project.getScmUrl().equals( oldScmRoot.getScmRootAddress() ) )
      {
        BeanUtils.copyProperties( oldScmRoot, newScmRoot, new String[]{"id", "projectGroup"} );
      }
      else
      {
        newScmRoot.setScmRootAddress( project.getScmUrl() );
      }
      newScmRoot.setProjectGroup( project.getProjectGroup() );
      projectScmRootDao.addProjectScmRoot( newScmRoot );
    }
  }
  catch ( ContinuumStoreException ex )
  {
    throw logAndCreateException( "Error while updating project.", ex );
  }
}

代码示例来源:origin: org.apache.continuum/continuum-buildagent-core

private ContinuumScmConfiguration createScmConfiguration( Project project, File workingDirectory )
{
  ContinuumScmConfiguration config = new ContinuumScmConfiguration();
  config.setUrl( project.getScmUrl() );
  // CONTINUUM-2628
  config = ContinuumScmUtils.setSCMCredentialsforSSH( config, project.getScmUrl(), project.getScmUsername(),
                            project.getScmPassword() );
  config.setUseCredentialsCache( project.isScmUseCache() );
  config.setWorkingDirectory( workingDirectory );
  config.setTag( project.getScmTag() );
  return config;
}

代码示例来源:origin: org.apache.continuum/continuum-core

for ( Project project : projects )
  if ( project.getScmUrl() != null && project.getScmUrl().startsWith( projectScmRoot.getScmRootAddress() ) )

代码示例来源:origin: org.apache.maven.continuum/continuum-core

if ( !p.getScmUrl().equals( project.getScmUrl() ) )

代码示例来源:origin: org.apache.continuum/continuum-core

public void execute( Map context )
  throws Exception
{
  Project project = projectDao.getProject( getProjectId( context ) );
  List<Project> projectsWithCommonScmRoot = getListOfProjectsInGroupWithCommonScmRoot( context );
  String projectScmRootUrl = getProjectScmRootUrl( context, project.getScmUrl() );
  File workingDirectory = workingDirectoryService.getWorkingDirectory( project, projectScmRootUrl,
                                     projectsWithCommonScmRoot );
  if ( !workingDirectory.exists() )
  {
    setWorkingDirectoryExists( context, false );
    return;
  }
  File[] files = workingDirectory.listFiles();
  if ( files == null )
  {
    //workingDirectory isn't a directory but a file. Not possible in theory.
    String msg = workingDirectory.getAbsolutePath() + " isn't a directory but a file.";
    getLogger().error( msg );
    throw new ContinuumException( msg );
  }
  setWorkingDirectoryExists( context, files.length > 0 );
}

代码示例来源:origin: org.apache.continuum/continuum-core

if ( project.getScmUrl().startsWith( projectScmRoot.getScmRootAddress() ) )

代码示例来源:origin: org.apache.maven.continuum/continuum-core

private ScmRepository getScmRepository( Project project, boolean useCredentialsCache )
  throws ScmRepositoryException, NoSuchScmProviderException
{
  ScmRepository repository = scmManager.makeScmRepository( project.getScmUrl().trim() );
  repository.getProviderRepository().setPersistCheckout( true );
  if ( !( useCredentialsCache && repository.getProvider().equals( "svn" ) ) )
  {
    if ( !StringUtils.isEmpty( project.getScmUsername() ) )
    {
      repository.getProviderRepository().setUser( project.getScmUsername() );
      if ( !StringUtils.isEmpty( project.getScmPassword() ) )
      {
        repository.getProviderRepository().setPassword( project.getScmPassword() );
      }
      else
      {
        repository.getProviderRepository().setPassword( "" );
      }
    }
  }
  if ( repository.getProvider().equals( "perforce" ) )
  {
    //Remove the clientspec name, so it will be recalcuated between each command for each project
    //instead of use the same for all projects
    System.setProperty( "maven.scm.perforce.clientspec.name", "" );
  }
  return repository;
}

代码示例来源:origin: org.apache.continuum/continuum-core

public void execute( Map context )
    throws Exception
  {
    Project project = projectDao.getProject( getProjectId( context ) );
    List<Project> projectsWithCommonScmRoot = getListOfProjectsInGroupWithCommonScmRoot( context );
    String projectScmRootUrl = getProjectScmRootUrl( context, project.getScmUrl() );

    File workingDirectory = workingDirectoryService.getWorkingDirectory( project, projectScmRootUrl,
                                       projectsWithCommonScmRoot );

    if ( workingDirectory.exists() )
    {
      FileSetManager fileSetManager = new FileSetManager();
      FileSet fileSet = new FileSet();
      fileSet.setDirectory( workingDirectory.getPath() );
      fileSet.addInclude( "**/**" );
      // TODO : this with a configuration option somewhere ?
      fileSet.setFollowSymlinks( false );
      fileSetManager.delete( fileSet );
    }
  }
}

代码示例来源:origin: org.apache.continuum/continuum-core

ProjectScmRoot projectScmRoot = null;
if ( !p.getScmUrl().equals( project.getScmUrl() ) )

代码示例来源:origin: org.apache.continuum/continuum-core

private ContinuumScmConfiguration createScmConfiguration( Project project, File workingDirectory,
                             String scmUserName, String scmPassword, String scmRootUrl,
                             boolean isRootDirectory )
{
  ContinuumScmConfiguration config = new ContinuumScmConfiguration();
  if ( project.isCheckedOutInSingleDirectory() && scmRootUrl != null && !"".equals( scmRootUrl ) &&
    isRootDirectory )
  {
    config.setUrl( scmRootUrl );
  }
  else
  {
    config.setUrl( project.getScmUrl() );
  }
  // CONTINUUM-2628
  config = ContinuumScmUtils.setSCMCredentialsforSSH( config, config.getUrl(), scmUserName, scmPassword );
  config.setUseCredentialsCache( project.isScmUseCache() );
  config.setWorkingDirectory( workingDirectory );
  config.setTag( project.getScmTag() );
  return config;
}

代码示例来源:origin: org.apache.continuum/continuum-buildagent-core

private ContinuumScmConfiguration createScmConfiguration( Project project, File workingDirectory )
{
  ContinuumScmConfiguration config = new ContinuumScmConfiguration();
  config.setUrl( project.getScmUrl() );
  config.setUsername( project.getScmUsername() );
  config.setPassword( project.getScmPassword() );
  config.setUseCredentialsCache( project.isScmUseCache() );
  config.setWorkingDirectory( workingDirectory );
  config.setTag( project.getScmTag() );
  return config;
}

代码示例来源:origin: org.apache.continuum/continuum-core

private ContinuumScmConfiguration createScmConfiguration( Project project, File workingDirectory,
                             String scmRootUrl )
{
  ContinuumScmConfiguration config = new ContinuumScmConfiguration();
  if ( project.isCheckedOutInSingleDirectory() && scmRootUrl != null && !"".equals( scmRootUrl ) )
  {
    config.setUrl( scmRootUrl );
  }
  else
  {
    config.setUrl( project.getScmUrl() );
  }
  // CONTINUUM-2628
  config = ContinuumScmUtils.setSCMCredentialsforSSH( config, config.getUrl(), project.getScmUsername(),
                            project.getScmPassword() );
  config.setUseCredentialsCache( project.isScmUseCache() );
  config.setWorkingDirectory( workingDirectory );
  config.setTag( project.getScmTag() );
  return config;
}

代码示例来源:origin: org.apache.maven.continuum/continuum-core

&& StringUtils.equalsIgnoreCase( project.getScmUrl(), storedProject.getScmUrl() ) )

代码示例来源:origin: org.apache.continuum/continuum-core

String projectScmRootUrl = getProjectScmRootUrl( context, project.getScmUrl() );

相关文章

Project类方法