code: private Model getPomModel ( String groupId, String artifactId, String version, File pom )
          throws ArtifactResolutionException, ArtifactNotFoundException, IOException, XmlPullParserException
      {
          Model model = null;
  
          // do we want to look in the reactor like the
          // project builder? Would require @aggregator goal
          // which causes problems in maven core right now
          // because we also need dependency resolution in
          // other
          // rules. (MNG-2277)
  
          // look in the location specified by pom first.
          boolean found = false;
          try
          {
              model = readModel( pom );
  
              // i found a model, lets make sure it's the one
              // I want
              found = checkIfModelMatches( groupId, artifactId, version, model );
          }
          catch ( IOException e )
          {
              // nothing here, but lets look in the repo
              // before giving up.
          }
          catch ( XmlPullParserException e )
          {
              // nothing here, but lets look in the repo
              // before giving up.
          }
  
          // i didn't find it in the local file system, go
          // look in the repo
          if ( !found )
          {
              Artifact pomArtifact = factory.createArtifact( groupId, artifactId, version, null, "pom" );
              resolver.resolve( pomArtifact, remoteRepositories, local );
              model = readModel( pomArtifact.getFile() );
          }
  
          return model;
      }
docs: This method gets the model for the defined artifact.
  Looks first in the filesystem, then tries to get it
  from the repo.
  
  @param groupId the group id
  @param artifactId the artifact id
  @param version the version
  @param pom the pom
  
  @return the pom model
  
  @throws ArtifactResolutionException the artifact resolution exception
  @throws ArtifactNotFoundException the artifact not found exception
  @throws XmlPullParserException the xml pull parser exception
  @throws IOException Signals that an I/O exception has occurred.