• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java IMavenProjectRegistry类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中org.eclipse.m2e.core.project.IMavenProjectRegistry的典型用法代码示例。如果您正苦于以下问题:Java IMavenProjectRegistry类的具体用法?Java IMavenProjectRegistry怎么用?Java IMavenProjectRegistry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

IMavenProjectRegistry类属于org.eclipse.m2e.core.project包,在下文中一共展示了IMavenProjectRegistry类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getMavenProperty

点赞 3

import org.eclipse.m2e.core.project.IMavenProjectRegistry; //导入依赖的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;
}
 

开发者ID:m-m-m,
项目名称:eclipse-templatevariables,
代码行数:27,
代码来源:AbstractMavenTemplateVariableResolver.java

示例2: getFinalArtifactPath

点赞 2

import org.eclipse.m2e.core.project.IMavenProjectRegistry; //导入依赖的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

示例3: create

点赞 2

import org.eclipse.m2e.core.project.IMavenProjectRegistry; //导入依赖的package包/类
@VisibleForTesting
static DataflowDependencyManager create(
    ArtifactRetriever artifactRetriever,
    IMaven maven,
    IMavenProjectRegistry mavenProjectRegistry) {
  return new DataflowDependencyManager(artifactRetriever, maven, mavenProjectRegistry);
}
 

开发者ID:GoogleCloudPlatform,
项目名称:google-cloud-eclipse,
代码行数:8,
代码来源:DataflowDependencyManager.java

示例4: DataflowDependencyManager

点赞 2

import org.eclipse.m2e.core.project.IMavenProjectRegistry; //导入依赖的package包/类
private DataflowDependencyManager(
    ArtifactRetriever artifactRetriever,
    IMaven maven,
    IMavenProjectRegistry mavenProjectRegistry) {
  this.artifactRetriever = artifactRetriever;
  this.maven = maven;
  this.mavenProjectRegistry = mavenProjectRegistry;
}
 

开发者ID:GoogleCloudPlatform,
项目名称:google-cloud-eclipse,
代码行数:9,
代码来源:DataflowDependencyManager.java

示例5: PomTranslatorJob

点赞 2

import org.eclipse.m2e.core.project.IMavenProjectRegistry; //导入依赖的package包/类
public PomTranslatorJob(IMavenProjectRegistry projectManager, IMavenMarkerManager markerManager, List<IFile> poms) {
  super("Pom translator");
  Assert.isNotNull(poms);
  this.projectManager = projectManager;
  this.markerManager = markerManager;
  this.poms = new ArrayList<>(poms);
}
 

开发者ID:jbosstools,
项目名称:m2e-polyglot-poc,
代码行数:8,
代码来源:PomTranslatorJob.java

示例6: DataflowMavenModelFactory

点赞 2

import org.eclipse.m2e.core.project.IMavenProjectRegistry; //导入依赖的package包/类
public DataflowMavenModelFactory(
    DataflowDependencyManager dependencyManager, IMavenProjectRegistry projectRegistry) {
  this.dependencyManager = dependencyManager;
  this.projectRegistry = projectRegistry;
}
 

开发者ID:GoogleCloudPlatform,
项目名称:google-cloud-eclipse,
代码行数:6,
代码来源:DataflowMavenModel.java

示例7: BuildPathManager

点赞 2

import org.eclipse.m2e.core.project.IMavenProjectRegistry; //导入依赖的package包/类
public BuildPathManager(IMavenProjectRegistry projectManager) {
	this.projectManager = projectManager;
}
 

开发者ID:maven-nar,
项目名称:m2e-nar,
代码行数:4,
代码来源:BuildPathManager.java

示例8: ConfiguratorContext

点赞 2

import org.eclipse.m2e.core.project.IMavenProjectRegistry; //导入依赖的package包/类
public ConfiguratorContext(final IMaven maven, final IMavenProjectRegistry projectManager) {
	this.maven = maven;
	this.projectManager = projectManager;
}
 

开发者ID:maven-nar,
项目名称:m2e-nar,
代码行数:5,
代码来源:ConfiguratorContext.java

示例9: getProjectManager

点赞 2

import org.eclipse.m2e.core.project.IMavenProjectRegistry; //导入依赖的package包/类
public IMavenProjectRegistry getProjectManager() {
	return projectManager;
}
 

开发者ID:maven-nar,
项目名称:m2e-nar,
代码行数:4,
代码来源:ConfiguratorContext.java

示例10: build

点赞 2

import org.eclipse.m2e.core.project.IMavenProjectRegistry; //导入依赖的package包/类
@Override
public Set<IProject> build(int kind, final IProgressMonitor monitor)
		throws Exception {

	final MojoExecution mojoExecution = getMojoExecution();

	if (mojoExecution == null) {
		return null;
	}

	final String phase = mojoExecution.getLifecyclePhase();
	log.debug("phase: {}", phase);

	final String goal = mojoExecution.getGoal();
	log.debug("goal: {}", goal);

	final IMaven maven = MavenPlugin.getMaven();
	final IMavenProjectFacade currentProject = getMavenProjectFacade();
	final BuildContext buildContext = getBuildContext();
	final IMavenProjectRegistry projectRegistry = MavenPlugin.getMavenProjectRegistry();

	ArtifactKey artifactKey = currentProject.getArtifactKey();
	String shortArtifactKey = artifactKey.getGroupId() + ":"
			+ artifactKey.getArtifactId() + ":" + artifactKey.getVersion();
	log.debug("artifact key: {}", shortArtifactKey);

	MavenProject mavenProject = currentProject.getMavenProject();
	// File basedir = mavenProject.getBasedir();
	// File inputPath = new File(basedir, "src");
	File inputPath = maven.getMojoParameterValue(mavenProject, mojoExecution, inputPathParam, File.class, monitor);
	
	String outputDirectoryPath = mavenProject.getBuild().getDirectory();
	File outputDirectory = new File(outputDirectoryPath);

	if (INCREMENTAL_BUILD == kind || AUTO_BUILD == kind) {
		log.debug("scan resources {}", inputPath);
		Scanner ds = buildContext.newScanner(inputPath);
		ds.scan();
		String[] files = ds.getIncludedFiles();
		if (files == null || files.length <= 0) {
			log.debug("build check: no resource changes");
			log.debug("scan deleted resources {}", inputPath);
			ds = buildContext.newDeleteScanner(inputPath);
			ds.scan();
			files = ds.getIncludedFiles();
			if (files == null || files.length <= 0) {
				return null;
			} else {
				log.debug("build check: resources deleted");
			}
		} else {
			log.debug("build check: resources changed");
		}
	} else {
		log.debug("build check: full build");
	}

	final Set<IProject> result = super.build(kind, monitor);

	IProject project = currentProject.getProject();
	project.refreshLocal(IResource.DEPTH_INFINITE, monitor);

	if (outputDirectory != null && outputDirectory.exists()) {
		log.debug("refresh output directory: {}", outputDirectory);
		buildContext.refresh(outputDirectory);
	}

	return result;
}
 

开发者ID:dashie,
项目名称:m2e-plugins,
代码行数:70,
代码来源:BuildParticipant.java

示例11: buildBundle

点赞 2

import org.eclipse.m2e.core.project.IMavenProjectRegistry; //导入依赖的package包/类
/**
 * 
 * @param kind
 * @param monitor
 * @return
 * @throws Exception
 */
private Set<IProject> buildBundle(int kind, IProgressMonitor monitor) throws Exception {

	log.info("process \"bundle\" goal");

	final IMaven maven = MavenPlugin.getMaven();
	final IMavenProjectFacade currentProject = getMavenProjectFacade();
	final MavenProject mavenProject = currentProject.getMavenProject();
	final BuildContext buildContext = getBuildContext();
	final IMavenProjectRegistry projectRegistry = MavenPlugin.getMavenProjectRegistry();

	ArtifactKey artifactKey = currentProject.getArtifactKey();
	String shortArtifactKey = artifactKey.getGroupId() + ":" + artifactKey.getArtifactId() + ":" + artifactKey.getVersion();
	log.debug("artifact key: {}", shortArtifactKey);

	File basedir = mavenProject.getBasedir();
	File sourcesDirectory = new File(basedir, "src");

	File resourcesDirectory = maven.getMojoParameterValue(getSession(), getMojoExecution(), "resourcesDirectory", File.class);
	File outputDirectory = maven.getMojoParameterValue(getSession(), getMojoExecution(), "outputDirectory", File.class);
	File remoteResourcesDescriptor = new File(outputDirectory, "META-INF/maven/remote-resources.xml");

	String preprocessedFiles = null; // (String) buildContext.getValue("preprocessedFiles");

	if (remoteResourcesDescriptor.exists()) {
		if ((INCREMENTAL_BUILD == kind || AUTO_BUILD == kind) && preprocessedFiles == null) {
			log.debug("scan resources {}", resourcesDirectory);
			Scanner ds = buildContext.newScanner(resourcesDirectory);
			ds.scan();
			String[] files = ds.getIncludedFiles();
			if (files == null || files.length <= 0) {
				log.debug("build check: no resource changes");
				log.debug("scan deleted resources {}", resourcesDirectory);
				ds = buildContext.newDeleteScanner(resourcesDirectory);
				ds.scan();
				files = ds.getIncludedFiles();
				if (files == null || files.length <= 0) {
					return null;
				} else {
					log.debug("build check: resources deleted");
				}
			} else {
				log.debug("build check: resources changed");
			}
		} else {
			log.debug("build check: full build");
		}
	} else {
		log.debug("build check: remote resources descriptor does not exists");
	}

	final Set<IProject> result = super.build(kind, monitor);
	if (outputDirectory != null && outputDirectory.exists()) {
		log.debug("refresh output directory: {}", outputDirectory);
		buildContext.refresh(outputDirectory);
	}

	return result;
}
 

开发者ID:dashie,
项目名称:m2e-plugins,
代码行数:66,
代码来源:BuildParticipant.java

示例12: configure

点赞 2

import org.eclipse.m2e.core.project.IMavenProjectRegistry; //导入依赖的package包/类
@Override
public void configure(ProjectConfigurationRequest request, IProgressMonitor monitor) throws CoreException {

	final IMavenProjectFacade mavenProjectFacade = request.getMavenProjectFacade();
	final IProject project = mavenProjectFacade.getProject();
	final IMavenProjectRegistry projectRegistry = MavenPlugin.getMavenProjectRegistry();

	Set<String> bundleSet = getResourceBundles(mavenProjectFacade, monitor);
	if (bundleSet.isEmpty()) {
		return;
	}

	IProjectDescription description = project.getDescription();

	IProject[] oldRefs = description.getReferencedProjects();
	Set<IProject> refs = new HashSet<IProject>();
	if (oldRefs != null) {
		refs.addAll(Arrays.asList(oldRefs));
	}

	IMavenProjectFacade[] mavenProjectFacades = projectRegistry.getProjects();
	for (IMavenProjectFacade facade : mavenProjectFacades) {
		IProject pi = facade.getProject();
		if (pi.equals(project)) {
			continue;
		}
		MavenProject mp = facade.getMavenProject(null);
		if (mp == null) {
			log.error("configure: [" + project + "] maven project reference is null " + pi);
		} else {
			if (addToReferences(mp, bundleSet)) {
				log.info("configure: [" + project + "] add maven project reference to " + pi);
				refs.add(pi);
			}
		}
	}

	IProject[] array = refs.toArray(new IProject[refs.size()]);
	description.setReferencedProjects(array);
	project.setDescription(description, monitor);
}
 

开发者ID:dashie,
项目名称:m2e-plugins,
代码行数:42,
代码来源:Configurator.java

示例13: build

点赞 2

import org.eclipse.m2e.core.project.IMavenProjectRegistry; //导入依赖的package包/类
@Override
	public Set<IProject> build(int kind, final IProgressMonitor monitor) throws Exception {

		final MojoExecution mojoExecution = getMojoExecution();

		if (mojoExecution == null) {
			return null;
		}

		final String phase = mojoExecution.getLifecyclePhase();
		log.debug("phase: {}", phase);

		final String goal = mojoExecution.getGoal();
		log.debug("goal: {}", goal);

		final IMaven maven = MavenPlugin.getMaven();
		final IMavenProjectFacade currentProject = getMavenProjectFacade();
		final BuildContext buildContext = getBuildContext();
		final IMavenProjectRegistry projectRegistry = MavenPlugin.getMavenProjectRegistry();

		ArtifactKey artifactKey = currentProject.getArtifactKey();
		String shortArtifactKey = artifactKey.getGroupId() + ":" + artifactKey.getArtifactId() + ":" + artifactKey.getVersion();
		log.debug("artifact key: {}", shortArtifactKey);

		MavenProject mavenProject = currentProject.getMavenProject();
		File basedir = mavenProject.getBasedir();
		File resourcesDirectory = new File(basedir, "src");
		String outputDirectoryPath = mavenProject.getBuild().getDirectory();
		File outputDirectory = new File(outputDirectoryPath);

		if (INCREMENTAL_BUILD == kind || AUTO_BUILD == kind) {
			log.debug("scan resources {}", resourcesDirectory);
			Scanner ds = buildContext.newScanner(resourcesDirectory);
			ds.scan();
			String[] files = ds.getIncludedFiles();
			if (files == null || files.length <= 0) {
				log.debug("build check: no resource changes");
				log.debug("scan deleted resources {}", resourcesDirectory);
				ds = buildContext.newDeleteScanner(resourcesDirectory);
				ds.scan();
				files = ds.getIncludedFiles();
				if (files == null || files.length <= 0) {
					return null;
				} else {
					log.debug("build check: resources deleted");
				}
			} else {
				log.debug("build check: resources changed");
			}
		} else {
			log.debug("build check: full build");
		}

		final Set<IProject> result = super.build(kind, monitor);

		IProject project = currentProject.getProject();
		project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
//		IFolder folder = project.getFolder("target");
//		folder.accept(new IResourceVisitor() {
//			@Override
//			public boolean visit(IResource resource) throws CoreException {
//				resource.touch(monitor);
//				return true;
//			}
//		});

		if (outputDirectory != null && outputDirectory.exists()) {
			log.debug("refresh output directory: {}", outputDirectory);
			buildContext.refresh(outputDirectory);
		}

		return result;
	}
 

开发者ID:dashie,
项目名称:m2e-plugins,
代码行数:74,
代码来源:BuildParticipant.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)