//gitlab地址
String gitlabUrl = "http:localhost:8081";
//需要登录gitlab账户,维护token值,access_token
String token = "******";
GitLabApi gitLabApi = new GitLabApi(gitlabUrl,token);
//获取所有项目
List<Project> projects = gitLabApi.getProjectApi().getProjects();
for (Project project : projects) {
//获取项目下分支
List<Branch> branches = gitLabApi.getRepositoryApi().getBranches(project.getId());
for (Branch branch : branches) {
//根据项目id、分支名称获取提交记录
List<Commit> commits = gitLabApi.getCommitsApi().getCommits(projectId, "master", null, null);
}
}
//获取所有用户
List<User> users = gitLabApi.getUserApi().getUsers();
gitlab4j获取项目、用户、分支、提交记录
最新推荐文章于 2024-04-10 09:33:00 发布