public List<String> extractClasspathEntries(File pomFile, String scope)
      throws MavenClasspathExtractionException {

    try {
      MavenRequest mavenRequest = mavenConfiguration();
      mavenRequest.setResolveDependencies(true);
      mavenRequest.setBaseDirectory(pomFile.getParent());
      mavenRequest.setPom(pomFile.getAbsolutePath());

      DependencyResolvingMavenEmbedder dependencyResolvingMavenEmbedder =
          new DependencyResolvingMavenEmbedder(getClass().getClassLoader(), mavenRequest);

      ProjectBuildingResult projectBuildingResult =
          dependencyResolvingMavenEmbedder.buildProject(pomFile);
      return getClasspathForScope(projectBuildingResult, scope);

    } catch (MavenEmbedderException mee) {
      throw new MavenClasspathExtractionException(mee);
    } catch (ComponentLookupException cle) {
      throw new MavenClasspathExtractionException(cle);
    } catch (DependencyResolutionRequiredException e) {
      throw new MavenClasspathExtractionException(e);
    } catch (ProjectBuildingException e) {
      throw new MavenClasspathExtractionException(e);
    }
  }