Java Code Examples for org.eclipse.m2e.core.project.IMavenProjectFacade#getPom()

The following examples show how to use org.eclipse.m2e.core.project.IMavenProjectFacade#getPom() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DataflowMavenModel.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
public DataflowMavenModel fromProject(IProject project) throws CoreException {
  Preconditions.checkNotNull(project);
  if (!DataflowJavaProjectNature.hasDataflowNature(project)) {
    String errorMessage = String.format(
        "Tried to create the Dataflow dependency of a non-Dataflow project %s",
        project.getName());
    DataflowCorePlugin.logWarning(errorMessage);
    throw new IllegalArgumentException(errorMessage);
  }
  IMavenProjectFacade facade = projectRegistry.getProject(project);
  IFile pomFile = facade.getPom();
  return fromIFile(pomFile);
}
 
Example 2
Source File: DataflowDependencyManager.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
private Model getModelFromProject(IProject project) {
  IMavenProjectFacade facade = mavenProjectRegistry.getProject(project);
  if (facade != null) {
    IFile pom = facade.getPom();
    try {
      return maven.readModel(pom.getContents());
    } catch (CoreException e) {
      return null;
    }
  }
  return null;
}