本文整理汇总了Java中org.eclipse.m2e.core.project.IMavenProjectFacade类的典型用法代码示例。如果您正苦于以下问题:Java IMavenProjectFacade类的具体用法?Java IMavenProjectFacade怎么用?Java IMavenProjectFacade使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IMavenProjectFacade类属于org.eclipse.m2e.core.project包,在下文中一共展示了IMavenProjectFacade类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSingleProjectWideAnnotationPath
import org.eclipse.m2e.core.project.IMavenProjectFacade; //导入依赖的package包/类
private String getSingleProjectWideAnnotationPath(final IMavenProjectFacade mavenProjectFacade,
final String propertyName) {
if (mavenProjectFacade == null) {
return null;
}
final MavenProject mavenProject = mavenProjectFacade.getMavenProject();
if (mavenProject == null) {
return null;
}
final Properties properties = mavenProject.getProperties();
if (properties == null) {
return null;
}
final String property = properties.getProperty(propertyName);
if (property == null) {
return null;
} else {
return property.trim();
}
}
示例2: getFacade
import org.eclipse.m2e.core.project.IMavenProjectFacade; //导入依赖的package包/类
/**
* Get the Maven Facade object of the new created project
*/
private IMavenProjectFacade getFacade(IProject project) {
ProjectRegistryManager projectManager = MavenPluginActivator.getDefault().getMavenProjectManagerImpl();
IMavenProjectFacade facade = null;
while (facade == null) {
// wait until the project was created
try {
Thread.sleep(100);
} catch (InterruptedException e) {
}
facade = projectManager.create(project, new NullProgressMonitor());
}
return facade;
}
示例3: addDependency
import org.eclipse.m2e.core.project.IMavenProjectFacade; //导入依赖的package包/类
/**
* Add the Maven dependency to the new created project
*/
private void addDependency(Model model, IMavenProjectFacade facade) {
String latestVersion = getLatestVersion();
Dependency dependency = new Dependency();
dependency.setGroupId(groupId);
dependency.setArtifactId(artifactId);
dependency.setVersion(latestVersion);
model.addDependency(dependency);
try {
FileOutputStream fos = new FileOutputStream(facade.getPomFile());
new MavenXpp3Writer().write(fos, model);
} catch (IOException e) {
}
}
示例4: updateProjectConfiguration
import org.eclipse.m2e.core.project.IMavenProjectFacade; //导入依赖的package包/类
/**
* Update the new created project
*/
private void updateProjectConfiguration(IMavenProjectFacade facade) {
ProjectRegistryManager projectManager = MavenPluginActivator.getDefault().getMavenProjectManagerImpl();
try {
MavenProject mavenProject = facade.getMavenProject(new NullProgressMonitor());
ProjectConfigurationRequest request = new ProjectConfigurationRequest(facade, mavenProject);
MavenExecutionContext executionContext = projectManager.createExecutionContext(facade.getPom(),
facade.getResolverConfiguration());
executionContext.execute(mavenProject, new ICallable<Void>() {
public Void call(IMavenExecutionContext context, IProgressMonitor monitor) throws CoreException {
ILifecycleMapping lifecycleMapping = LifecycleMappingFactory.getLifecycleMapping(facade);
if (lifecycleMapping != null) {
lifecycleMapping.configure(request, monitor);
LifecycleMappingConfiguration.persist(request.getMavenProjectFacade(), monitor);
}
return null;
}
}, new NullProgressMonitor());
} catch (CoreException e) {
e.printStackTrace();
}
}
示例5: execute
import org.eclipse.m2e.core.project.IMavenProjectFacade; //导入依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
final IProject project = getSelectedProject(event);
if (project == null) {
return null;
}
final Shell shell = HandlerUtil.getActiveShell(event);
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
IMavenProjectFacade facade = MavenPlugin.getMavenProjectRegistry().create(project, new NullProgressMonitor());
if (facade == null) {
return;
}
PolyglotTranslaterWizard wizard = new PolyglotTranslaterWizard(facade);
WizardDialog wizardDialog = new WizardDialog(shell, wizard);
wizardDialog.setPageSize(150, 100);
wizardDialog.open();
}
});
return null;
}
示例6: crawlModules
import org.eclipse.m2e.core.project.IMavenProjectFacade; //导入依赖的package包/类
private static void crawlModules(IMavenProjectFacade parent, LinkedHashSet<IMavenProjectFacade> modules, List<IMavenProjectFacade> allFacades, IProgressMonitor monitor) {
if (!parent.getPackaging().equals("pom")) {
return;
}
IPath path = parent.getProject().getLocation();
for (String module : parent.getMavenProjectModules()) {
if (monitor.isCanceled()) {
break;
}
IPath modulePath = path.append(module);
IMavenProjectFacade moduleProject = findFacade(modulePath, allFacades);
if (moduleProject != null) {
modules.add(moduleProject);
allFacades.remove(moduleProject);
crawlModules(moduleProject, modules, allFacades, monitor);
}
}
}
示例7: getMavenProperty
import org.eclipse.m2e.core.project.IMavenProjectFacade; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected String getMavenProperty(IMavenProjectFacade projectFacade) {
String result = "";
final ArtifactKey mavenProject = projectFacade.getArtifactKey();
if (mavenProject != null) {
result = mavenProject.getVersion();
// remove snapshot-indicator
final int index = result.lastIndexOf("-SNAPSHOT");
if (index != -1) {
result = result.substring(0, index);
}
}
return result;
}
示例8: getMavenProperty
import org.eclipse.m2e.core.project.IMavenProjectFacade; //导入依赖的package包/类
/**
* Get the current maven project version.
*
* @param project is the {@link IProject}.
* @return the maven project version excluding a potential "-SNAPSHOT" suffix.
*/
private String getMavenProperty(IProject project) {
if (project == null) {
throw new IllegalArgumentException("Missing project");
}
String result = "";
try {
// IMavenConstants.NATURE_ID
if (project.hasNature("org.eclipse.m2e.core.maven2Nature")) {
final IMavenProjectRegistry projectRegistry = MavenPlugin.getMavenProjectRegistry();
final IMavenProjectFacade projectFacade = projectRegistry.create(project, new NullProgressMonitor());
if (projectFacade != null) {
result = getMavenProperty(projectFacade);
}
}
} catch (CoreException ex) {
throw new IllegalStateException(ex);
}
return result;
}
示例9: updateBuildPaths
import org.eclipse.m2e.core.project.IMavenProjectFacade; //导入依赖的package包/类
private void updateBuildPaths(IProject project, IProgressMonitor monitor) throws CoreException {
final IMavenProjectFacade facade = projectManager.getProject(project);
if (facade != null) {
final ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();
final ICProjectDescription des = mngr.getProjectDescription(project, true);
if (des != null) {
boolean changed = false;
logger.debug("updateBuildPaths: project=" + project.getName());
final ConfiguratorContext context = new ConfiguratorContext(MavenPlugin.getMaven(), projectManager);
List<NarExecution> narExecutions = MavenUtils.buildCompileNarExecutions(context, facade, monitor);
narExecutions.addAll(MavenUtils.buildTestCompileNarExecutions(context, facade, monitor));
for (NarExecution narSettings : narExecutions) {
if (!narSettings.isSkip()) {
final String os = narSettings.getOS();
final String linkerName = narSettings.getLinkerName();
final AbstractSettingsSynchroniser synchro = SynchroniserFactory.getSettingsSynchroniser(os, linkerName);
changed = updateCdtBuildPaths(des, synchro, narSettings);
}
}
if (changed) {
mngr.setProjectDescription(project, des);
}
}
}
}
示例10: getExecutions
import org.eclipse.m2e.core.project.IMavenProjectFacade; //导入依赖的package包/类
public static List<MojoExecution> getExecutions(final String goal, final ConfiguratorContext context, final IMavenProjectFacade facade,
final IProgressMonitor monitor) throws CoreException {
final List<MojoExecution> compileExecutions = new ArrayList<MojoExecution>();
final Map<String, Set<MojoExecutionKey>> configuratorExecutions = AbstractProjectConfigurator.getConfiguratorExecutions(facade);
final Set<MojoExecutionKey> executionKeys = configuratorExecutions.get(CProjectConfigurator.CONFIGURATOR_ID);
if (executionKeys != null) {
for (MojoExecutionKey key : executionKeys) {
final MojoExecution mojoExecution = facade.getMojoExecution(key, monitor);
if (goal.equals(mojoExecution.getGoal())) {
compileExecutions.add(mojoExecution);
}
}
}
return compileExecutions;
}
示例11: prepareNarArtifacts
import org.eclipse.m2e.core.project.IMavenProjectFacade; //导入依赖的package包/类
public void prepareNarArtifacts(final ConfiguratorContext context, IMavenProjectFacade facade, IProgressMonitor monitor) throws MojoExecutionException,
CoreException, MojoFailureException {
narDependencies = new LinkedList<NarArtifact>();
for (Iterator<Artifact> i = getArtifacts().iterator(); i.hasNext();) {
Artifact dependency = i.next();
getLog().debug("Examining artifact for NarInfo: " + dependency);
NarLayout layout;
EclipseNarLayout eclipseLayout = resolveEclipseProject(dependency, context, facade, monitor);
NarInfo narInfo;
if (eclipseLayout != null) {
layout = eclipseLayout;
narInfo = getNarInfo(dependency, eclipseLayout);
} else {
layout = getLayout();
narInfo = getNarInfo(dependency);
}
if (narInfo != null) {
getLog().debug(" - added as NarDependency");
narDependencies.add(new NarArtifact(dependency, narInfo, layout));
}
}
getLog().debug("Dependencies contained " + narDependencies.size() + " NAR artifacts.");
}
示例12: getBuildParticipant
import org.eclipse.m2e.core.project.IMavenProjectFacade; //导入依赖的package包/类
@Override
public AbstractBuildParticipant getBuildParticipant(
IMavenProjectFacade projectFacade, MojoExecution execution,
IPluginExecutionMetadata executionMetadata) {
String artifactId = execution.getArtifactId();
if (log.isDebugEnabled()) {
log.debug("getBuildParticipant: artifactId={}", artifactId);
}
String inputPathParam;
String outputPathParam;
if ("libsass-maven-plugin".equals(artifactId)) {
inputPathParam = "inputPath";
outputPathParam = "outputPath";
} else if ("sass-maven-plugin".equals(artifactId)) {
inputPathParam = "sassSourceDirectory";
outputPathParam = "destination";
} else {
throw new IllegalStateException("Unsupported artifactId <"
+ artifactId + ">");
}
return new BuildParticipant(execution, inputPathParam, outputPathParam);
}
示例13: getResourceBundles
import org.eclipse.m2e.core.project.IMavenProjectFacade; //导入依赖的package包/类
/**
*
* @param mavenProjectFacade
* @return
*/
private Set<String> getResourceBundles(IMavenProjectFacade mavenProjectFacade, IProgressMonitor monitor) throws CoreException {
Set<String> bundles = new HashSet<String>();
List<MojoExecution> executions = mavenProjectFacade.getMojoExecutions(Activator.MAVEN_GROUP_ID, Activator.MAVEN_ARTIFACT_ID, monitor, "process");
for (MojoExecution execution : executions) {
Xpp3Dom node = execution.getConfiguration();
if (node != null) {
node = node.getChild("resourceBundles");
if (node != null) {
Xpp3Dom[] nodes = node.getChildren("resourceBundle");
if (nodes != null) {
for (Xpp3Dom n : nodes) {
String bundle = n.getValue();
bundles.add(bundle);
}
}
}
}
}
return bundles;
}
示例14: getFinalArtifactPath
import org.eclipse.m2e.core.project.IMavenProjectFacade; //导入依赖的package包/类
private static IPath getFinalArtifactPath(IProject project) throws CoreException {
IMavenProjectRegistry projectManager = MavenPlugin.getMavenProjectRegistry();
IMavenProjectFacade projectFacade = projectManager.create(project, new NullProgressMonitor());
MavenProject mavenProject = projectFacade.getMavenProject(new NullProgressMonitor());
String buildDirectory = mavenProject.getBuild().getDirectory();
String finalName = mavenProject.getBuild().getFinalName();
String finalArtifactPath = buildDirectory + "/" + finalName + "." + mavenProject.getPackaging();
return new Path(finalArtifactPath);
}
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:11,代码来源:FlexMavenPackagedProjectStagingDelegate.java
示例15: fromProject
import org.eclipse.m2e.core.project.IMavenProjectFacade; //导入依赖的package包/类
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);
}