FreeStyleProject project = createFreeStyleProject();
project.setScm(new GitSCM(
createRemoteRepositories(relativeTargetDir),
Collections.singletonList(new BranchSpec(branchString)),
new PreBuildMergeOptions(), false, Collections.<SubmoduleConfig>emptyList(), false,
false, new DefaultBuildChooser(), null, null, authorOrCommitter, relativeTargetDir,
excludedRegions, excludedUsers, localBranch, false, false, null, null, false));
project.getBuildersList().add(new CaptureEnvironmentBuilder());
return project;
}