/** * Initialize a new git repository. * * @param dir The directory in which to create a new .git/ folder and repository. */ public static Git init(final DirectoryResource dir) throws IOException { FileResource<?> gitDir = dir.getChildDirectory(".git").reify(FileResource.class); gitDir.mkdirs(); RepositoryBuilder db = new RepositoryBuilder().setGitDir(gitDir.getUnderlyingResourceObject()).setup(); Git git = new Git(db.build()); git.getRepository().create(); return git; }
@Override public DirectoryResource getTestResourceFolder() { MavenCoreFacet mavenFacet = project.getFacet(MavenCoreFacet.class); Build build = mavenFacet.getPOM().getBuild(); final String resFolderName; if (build != null && !build.getTestResources().isEmpty() && build.getTestResources().get(0).getDirectory() != null) { resFolderName = build.getTestResources().get(0).getDirectory(); } else { resFolderName = "src" + File.separator + "test" + File.separator + "resources"; } DirectoryResource projectRoot = project.getProjectRoot(); return projectRoot.getChildDirectory(resFolderName); }
@Override public DirectoryResource getSourceFolder() { DirectoryResource projectRoot = project.getProjectRoot(); return projectRoot.getChildDirectory("src" + File.separator + "main" + File.separator + "java"); }