我想自动化我们的project.Below中的分支创建过程,这些步骤是使用Anthill手动完成的。在我们的Anthill中,我们有大约250个Java项目,它们的工作流是根据它们的发布名命名的,比如RB-16.4.5。
步骤1:使用当前分支复制每个项目的工作流,比如RB-16.4.5。
步骤2:编辑工作流名称为新的分支名称,如RB-16.4.6,并将源更改为最新的分支名称,如
步骤3:对于我们在Anthill.So中添加了依赖项的许多项目,我们希望用最新的分支projects.So更新它们,我们所做的是删除旧的依赖项,比如ProjectA RB-16.4.5,并通过进入创建的新工作流的管理TAB添加新的依赖项,并搜索具有文件夹名称ProjectA RB-16.4.6的新项目。
现在,我编写的代码在前两个步骤中运行良好,但无法找到如何为步骤3编写代码,因为无法找到如何获得我们上面创建的新工作流的最新依赖关系项目。documentation.We无法将依赖项的名称设置或更改为新名称。
我已经通过了doc/UrbanCode/AnthillPro/remoting/api/index.html提供的官方Java API。
AnthillClient client;
String currentBranch="RB-16.4.5";
String newBranch="RB-16.4.6";
UnitofWork uow=client.createUnitOfWork();
Folder[] allFolders=FolderFactory.getInstance().restoreAll();
Project[] myProjects={};
for(int i=0;i<allFolders.length;i++){
if(allFolders[i].getName().equals("MyPrjFolder")){
myProjects=allFolders[i].getProjects();
break;
}
//For each project copy the workflow and set New branch name & Source URL
for(int j=0;j<myProjects.length;j++){
Workflow flow=WorkflowLookup.getForProjectAndName(myProjects[j],newBranch);
Workflow newworkFlow=flow.duplicateForCopy(myProjects[j]);
newworkFlow.setUnitOfWork(uow);
newworkFlow.setName(newBranch);
newworkFlow.setNew(true);
newworkFlow.setActive(true);
SvnSourceConfig svnConfig=
(SvnSourceConfig) newWorkFlow.getBuildProfile().getSourceConfig();
SvnModule[] svnModule=svnConfig.getModuleArray();
String sourceURL=svnModule[0].getUrl();
svnModule[0].setUrl(sourceURL.replace(currentBranch,newBranch));
// Store the dependencies of old project branch in a list
Dependency
existingDependencies=flow.getBuildProfile().getAnthillDependencyArray();
someList.add(existingDependencies);
}
/*Now how do i set the Dependencies for each Project with new Project of
the new Branch if i have already stored the old dependecies of projects*/
// Code to create and add dependency should be something like
// How do i get the newDependency value which refers to the Project under new workflow created
Dependency newDependency=null;
newDependency= Dependency.createDependency(existingDependencies[i].getDependent),newDependency.getDependency());}
发布于 2016-07-31 12:15:54
换个办法怎么样?从最终用户获得作为输入的分支名称?
https://stackoverflow.com/questions/38677098
复制相似问题