/** * Get the helper that will be able to parse the specified build file. The helper * will be chosen among the ones found in the classpath * * @param buildFile Resource * @return the first ProjectHelper that fit the requirement (never <code>null</code>). */ public ProjectHelper getProjectHelperForBuildFile(Resource buildFile) throws BuildException { ProjectHelper ph = StreamUtils.iteratorAsStream(getHelpers()) .filter(helper -> helper.canParseBuildFile(buildFile)) .findFirst().orElse(null); if (ph == null) { throw new BuildException("BUG: at least the ProjectHelper2 should " + "have supported the file " + buildFile); } if (DEBUG) { System.out.println("ProjectHelper " + ph.getClass().getName() + " selected for the build file " + buildFile); } return ph; }