Java 类org.apache.maven.project.ProjectBuilderConfiguration 实例源码

项目:intellij-ce-playground    文件:CustomMaven3ModelInterpolator.java   
@Override
protected void interpolateObject(Object obj,
                                              Model model,
                                              File projectDir,
                                              ProjectBuilderConfiguration config,
                                              boolean debugEnabled) throws ModelInterpolationException {
  // IDEA-74131 avoid concurrent access to the static cache in StringSearchModelInterpolator
  synchronized (CustomMaven3ModelInterpolator.class) {
    try {
      super.interpolateObject(obj, model, projectDir, config, debugEnabled);
    }
    catch (NullPointerException e) {
      // npe may be thrown from here:
      //at org.apache.maven.project.interpolation.StringSearchModelInterpolator$InterpolateObjectAction.isQualifiedForInterpolation(StringSearchModelInterpolator.java:344)
      //at org.apache.maven.project.interpolation.StringSearchModelInterpolator$InterpolateObjectAction.traverseObjectWithParents(StringSearchModelInterpolator.java:172)
      //at org.apache.maven.project.interpolation.StringSearchModelInterpolator$InterpolateObjectAction.traverseObjectWithParents(StringSearchModelInterpolator.java:328)
      //at org.apache.maven.project.interpolation.StringSearchModelInterpolator$InterpolateObjectAction.run(StringSearchModelInterpolator.java:135)
      //at org.apache.maven.project.interpolation.StringSearchModelInterpolator$InterpolateObjectAction.run(StringSearchModelInterpolator.java:102)
      throw new ModelInterpolationException("Cannot interpolate", e);
    }
  }
}
项目:intellij-ce-playground    文件:CustomModelInterpolator.java   
@Override
protected void interpolateObject(Object obj, Model model, File projectDir, ProjectBuilderConfiguration config, boolean debugEnabled)
  throws ModelInterpolationException {
  // IDEA-74131 avoid concurrent access to the static cache in StringSearchModelInterpolator
  synchronized (CustomModelInterpolator.class) {
    try {
      super.interpolateObject(obj, model, projectDir, config, debugEnabled);
    }
    catch (NullPointerException e) {
      // npe may be thrown from here:
      //at org.apache.maven.project.interpolation.StringSearchModelInterpolator$InterpolateObjectAction.isQualifiedForInterpolation(StringSearchModelInterpolator.java:344)
      //at org.apache.maven.project.interpolation.StringSearchModelInterpolator$InterpolateObjectAction.traverseObjectWithParents(StringSearchModelInterpolator.java:172)
      //at org.apache.maven.project.interpolation.StringSearchModelInterpolator$InterpolateObjectAction.traverseObjectWithParents(StringSearchModelInterpolator.java:328)
      //at org.apache.maven.project.interpolation.StringSearchModelInterpolator$InterpolateObjectAction.run(StringSearchModelInterpolator.java:135)
      //at org.apache.maven.project.interpolation.StringSearchModelInterpolator$InterpolateObjectAction.run(StringSearchModelInterpolator.java:102)
      throw new ModelInterpolationException("Cannot interpolate", e);
    }
  }
}
项目:tools-idea    文件:CustomMaven3ModelInterpolator.java   
@Override
protected void interpolateObject(Object obj,
                                              Model model,
                                              File projectDir,
                                              ProjectBuilderConfiguration config,
                                              boolean debugEnabled) throws ModelInterpolationException {
  // IDEA-74131 avoid concurrent access to the static cache in StringSearchModelInterpolator
  synchronized (CustomMaven3ModelInterpolator.class) {
    try {
      super.interpolateObject(obj, model, projectDir, config, debugEnabled);
    }
    catch (NullPointerException e) {
      // npe may be thrown from here:
      //at org.apache.maven.project.interpolation.StringSearchModelInterpolator$InterpolateObjectAction.isQualifiedForInterpolation(StringSearchModelInterpolator.java:344)
      //at org.apache.maven.project.interpolation.StringSearchModelInterpolator$InterpolateObjectAction.traverseObjectWithParents(StringSearchModelInterpolator.java:172)
      //at org.apache.maven.project.interpolation.StringSearchModelInterpolator$InterpolateObjectAction.traverseObjectWithParents(StringSearchModelInterpolator.java:328)
      //at org.apache.maven.project.interpolation.StringSearchModelInterpolator$InterpolateObjectAction.run(StringSearchModelInterpolator.java:135)
      //at org.apache.maven.project.interpolation.StringSearchModelInterpolator$InterpolateObjectAction.run(StringSearchModelInterpolator.java:102)
      throw new ModelInterpolationException("Cannot interpolate", e);
    }
  }
}
项目:tools-idea    文件:CustomModelInterpolator.java   
@Override
protected void interpolateObject(Object obj, Model model, File projectDir, ProjectBuilderConfiguration config, boolean debugEnabled)
  throws ModelInterpolationException {
  // IDEA-74131 avoid concurrent access to the static cache in StringSearchModelInterpolator
  synchronized (CustomModelInterpolator.class) {
    try {
      super.interpolateObject(obj, model, projectDir, config, debugEnabled);
    }
    catch (NullPointerException e) {
      // npe may be thrown from here:
      //at org.apache.maven.project.interpolation.StringSearchModelInterpolator$InterpolateObjectAction.isQualifiedForInterpolation(StringSearchModelInterpolator.java:344)
      //at org.apache.maven.project.interpolation.StringSearchModelInterpolator$InterpolateObjectAction.traverseObjectWithParents(StringSearchModelInterpolator.java:172)
      //at org.apache.maven.project.interpolation.StringSearchModelInterpolator$InterpolateObjectAction.traverseObjectWithParents(StringSearchModelInterpolator.java:328)
      //at org.apache.maven.project.interpolation.StringSearchModelInterpolator$InterpolateObjectAction.run(StringSearchModelInterpolator.java:135)
      //at org.apache.maven.project.interpolation.StringSearchModelInterpolator$InterpolateObjectAction.run(StringSearchModelInterpolator.java:102)
      throw new ModelInterpolationException("Cannot interpolate", e);
    }
  }
}
项目:oceano    文件:AbstractStringBasedModelInterpolator.java   
/**
 * Interpolates all expressions in the src parameter.
 * <p>
 * The algorithm used for each expression is:
 * <ul>
 *   <li>If it starts with either "pom." or "project.", the expression is evaluated against the model.</li>
 *   <li>If the value is null, get the value from the context.</li>
 *   <li>If the value is null, but the context contains the expression, don't replace the expression string
 *       with the value, and continue to find other expressions.</li>
 *   <li>If the value is null, get it from the model properties.</li>
 *   <li>
 * @param overrideContext
 * @param outputDebugMessages
 */
public String interpolate( String src,
                           Model model,
                           final File projectDir,
                           ProjectBuilderConfiguration config,
                           boolean debug )
    throws ModelInterpolationException
{
    try
    {
        List<ValueSource> valueSources = createValueSources( model, projectDir, config );
        List<InterpolationPostProcessor> postProcessors = createPostProcessors( model, projectDir, config );

        return interpolateInternal( src, valueSources, postProcessors, debug );
    }
    finally
    {
        interpolator.clearAnswers();
    }
}
项目:oceano    文件:StringSearchModelInterpolator.java   
protected void interpolateObject( Object obj, Model model, File projectDir, ProjectBuilderConfiguration config,
                                  boolean debugEnabled )
    throws ModelInterpolationException
{
    try
    {
        List<ValueSource> valueSources = createValueSources( model, projectDir, config );
        List<InterpolationPostProcessor> postProcessors = createPostProcessors( model, projectDir, config );

        InterpolateObjectAction action =
            new InterpolateObjectAction( obj, valueSources, postProcessors, debugEnabled,
                                         this, getLogger() );

        ModelInterpolationException error = AccessController.doPrivileged( action );

        if ( error != null )
        {
            throw error;
        }
    }
    finally
    {
        getInterpolator().clearAnswers();
    }
}
项目:greenpepper    文件:CommandLineRunner.java   
private void interpolateProject() throws InitializationException, Exception, ModelInterpolationException {
    StringSearchModelInterpolator interpolator = new StringSearchModelInterpolator(new DefaultPathTranslator());
    interpolator.enableLogging(new PlexusLoggerAdapter(embedder.getLogger()));
    interpolator.initialize();
    ProjectBuilderConfiguration config =  new DefaultProjectBuilderConfiguration();
    config.setLocalRepository(getLocalRepository());
    config.setGlobalProfileManager(getProfileManager());
    interpolator.interpolate(project.getModel(), project.getBasedir(), config, logger.isDebugEnabled());
}
项目:oceano    文件:AbstractStringBasedModelInterpolator.java   
protected List<InterpolationPostProcessor> createPostProcessors( final Model model, final File projectDir,
                                                                 final ProjectBuilderConfiguration config )
{
    return Collections.singletonList( (InterpolationPostProcessor) new PathTranslatingPostProcessor(
                                                                                                     PROJECT_PREFIXES,
                                                                                                     TRANSLATED_PATH_EXPRESSIONS,
                                                                                                     projectDir,
                                                                                                     pathTranslator ) );
}
项目:oceano    文件:StringSearchModelInterpolator.java   
public Model interpolate( Model model, File projectDir, ProjectBuilderConfiguration config, boolean debugEnabled )
    throws ModelInterpolationException
{
    interpolateObject( model, model, projectDir, config, debugEnabled );

    return model;
}
项目:intellij-ce-playground    文件:MavenEmbedder.java   
@NotNull
public MavenExecutionResult resolveProject(@NotNull final File file,
                                           @NotNull final List<String> activeProfiles,
                                           @NotNull final List<String> inactiveProfiles,
                                           List<ResolutionListener> listeners) {
  MavenExecutionRequest request = createRequest(file, activeProfiles, inactiveProfiles, Collections.<String>emptyList());
  ProjectBuilderConfiguration config = request.getProjectBuilderConfiguration();

  request.getGlobalProfileManager().loadSettingsProfiles(mySettings);

  ProfileManager globalProfileManager = request.getGlobalProfileManager();
  globalProfileManager.loadSettingsProfiles(request.getSettings());

  List<Exception> exceptions = new ArrayList<Exception>();
  MavenProject project = null;
  try {
    // copied from DefaultMavenProjectBuilder.buildWithDependencies
    MavenProjectBuilder builder = getComponent(MavenProjectBuilder.class);
    project = builder.build(new File(file.getPath()), config);
    builder.calculateConcreteState(project, config, false);

    // copied from DefaultLifecycleExecutor.execute
    findExtensions(project);
    // end copied from DefaultLifecycleExecutor.execute

    Artifact projectArtifact = project.getArtifact();
    Map managedVersions = project.getManagedVersionMap();
    ArtifactMetadataSource metadataSource = getComponent(ArtifactMetadataSource.class);
    project.setDependencyArtifacts(project.createArtifacts(getComponent(ArtifactFactory.class), null, null));

    ArtifactResolver resolver = getComponent(ArtifactResolver.class);
    ArtifactResolutionResult result = resolver
      .resolveTransitively(project.getDependencyArtifacts(), projectArtifact, managedVersions, myLocalRepository,
                           project.getRemoteArtifactRepositories(), metadataSource, null, listeners);
    project.setArtifacts(result.getArtifacts());
    // end copied from DefaultMavenProjectBuilder.buildWithDependencies
  }
  catch (Exception e) {
    return handleException(e);
  }

  return new MavenExecutionResult(project, exceptions);
}
项目:tools-idea    文件:MavenEmbedder.java   
@NotNull
public MavenExecutionResult resolveProject(@NotNull final File file,
                                           @NotNull final List<String> activeProfiles,
                                           List<ResolutionListener> listeners) {
  MavenExecutionRequest request = createRequest(file, activeProfiles, Collections.<String>emptyList(), Collections.<String>emptyList());
  ProjectBuilderConfiguration config = request.getProjectBuilderConfiguration();

  request.getGlobalProfileManager().loadSettingsProfiles(mySettings);

  ProfileManager globalProfileManager = request.getGlobalProfileManager();
  globalProfileManager.loadSettingsProfiles(request.getSettings());

  List<Exception> exceptions = new ArrayList<Exception>();
  MavenProject project = null;
  try {
    // copied from DefaultMavenProjectBuilder.buildWithDependencies
    MavenProjectBuilder builder = getComponent(MavenProjectBuilder.class);
    project = builder.build(new File(file.getPath()), config);
    builder.calculateConcreteState(project, config, false);

    // copied from DefaultLifecycleExecutor.execute
    findExtensions(project);
    // end copied from DefaultLifecycleExecutor.execute

    Artifact projectArtifact = project.getArtifact();
    Map managedVersions = project.getManagedVersionMap();
    ArtifactMetadataSource metadataSource = getComponent(ArtifactMetadataSource.class);
    project.setDependencyArtifacts(project.createArtifacts(getComponent(ArtifactFactory.class), null, null));

    ArtifactResolver resolver = getComponent(ArtifactResolver.class);
    ArtifactResolutionResult result = resolver
      .resolveTransitively(project.getDependencyArtifacts(), projectArtifact, managedVersions, myLocalRepository,
                           project.getRemoteArtifactRepositories(), metadataSource, null, listeners);
    project.setArtifacts(result.getArtifacts());
    // end copied from DefaultMavenProjectBuilder.buildWithDependencies
  }
  catch (Exception e) {
    return handleException(e);
  }

  return new MavenExecutionResult(project, exceptions);
}
项目:oceano    文件:ModelInterpolator.java   
Model interpolate( Model model,
               File projectDir,
               ProjectBuilderConfiguration config,
               boolean debugEnabled )
throws ModelInterpolationException;
项目:oceano    文件:ModelInterpolator.java   
String interpolate( String src,
                Model model,
                File projectDir,
                ProjectBuilderConfiguration config,
                boolean debugEnabled )
throws ModelInterpolationException;