use of org.apache.maven.project.ProjectBuilderConfiguration in project che by eclipse.
the class MavenServerImpl method internalInterpolate.
private static Model internalInterpolate(Model model, File projectDir) throws RemoteException {
try {
AbstractStringBasedModelInterpolator interpolator = new org.apache.maven.project.interpolation.StringSearchModelInterpolator(new DefaultPathTranslator());
interpolator.initialize();
//MavenServerUtil.collectSystemProperties();
Properties props = new Properties();
ProjectBuilderConfiguration config = new DefaultProjectBuilderConfiguration().setExecutionProperties(props);
config.setBuildStartTime(new Date());
model = interpolator.interpolate(model, projectDir, config, false);
} catch (ModelInterpolationException e) {
MavenServerContext.getLogger().warning(e);
} catch (InitializationException e) {
MavenServerContext.getLogger().error(e);
}
return model;
}
use of org.apache.maven.project.ProjectBuilderConfiguration in project intellij-community by JetBrains.
the class MavenEmbedder method resolveProject.
@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);
}
Aggregations