本文整理汇总了Java中org.apache.maven.project.MavenProjectBuilder.calculateConcreteState方法的典型用法代码示例。如果您正苦于以下问题:Java MavenProjectBuilder.calculateConcreteState方法的具体用法?Java MavenProjectBuilder.calculateConcreteState怎么用?Java MavenProjectBuilder.calculateConcreteState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.maven.project.MavenProjectBuilder
的用法示例。
在下文中一共展示了MavenProjectBuilder.calculateConcreteState方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resolveProject
import org.apache.maven.project.MavenProjectBuilder; //导入方法依赖的package包/类
@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);
}
示例2: resolveProject
import org.apache.maven.project.MavenProjectBuilder; //导入方法依赖的package包/类
@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);
}