本文整理汇总了Java中org.eclipse.m2e.core.embedder.IMaven类的典型用法代码示例。如果您正苦于以下问题:Java IMaven类的具体用法?Java IMaven怎么用?Java IMaven使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IMaven类属于org.eclipse.m2e.core.embedder包,在下文中一共展示了IMaven类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getLatestVersion
import org.eclipse.m2e.core.embedder.IMaven; //导入依赖的package包/类
public static String getLatestVersion(Artifact artifact, IProgressMonitor monitor) throws CoreException {
monitor.beginTask("Getting latest version for " + artifact.getGroupId() + ":" + artifact.getArtifactId(), 1);
try {
final IMaven maven = MavenPlugin.getMaven();
final ArtifactMetadataSource source = ((MavenImpl) maven).getPlexusContainer().lookup(
ArtifactMetadataSource.class, "org.apache.maven.artifact.metadata.ArtifactMetadataSource", "maven"); //$NON-NLS-1$ $NON-NLS-2$
List<ArtifactVersion> versions = source.retrieveAvailableVersions(artifact, maven.getLocalRepository(),
maven.getArtifactRepositories());
Collections.reverse(versions);
for (ArtifactVersion artifactVersion : versions) {
String version = artifactVersion.toString();
if (!version.endsWith("-SNAPSHOT")) {
return version;
}
}
} catch (Exception e) {
throw new CoreException(
new Status(Status.ERROR, PolyglotSupportActivator.PLUGIN_ID, "Error resolving version range", e)); //$NON-NLS-1$
}
return null;
}
开发者ID:jbosstools,项目名称:m2e-polyglot-poc,代码行数:23,代码来源:ArtifactSearcher.java
示例2: create
import org.eclipse.m2e.core.embedder.IMaven; //导入依赖的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
示例3: DataflowDependencyManager
import org.eclipse.m2e.core.embedder.IMaven; //导入依赖的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
示例4: build
import org.eclipse.m2e.core.embedder.IMaven; //导入依赖的package包/类
@Override
public Set<IProject> build( int kind, IProgressMonitor monitor )
throws Exception
{
IMaven maven = MavenPlugin.getMaven();
BuildContext buildContext = getBuildContext();
// check if any of the grammar files changed
File source = maven.getMojoParameterValue(getSession(), getMojoExecution(), "schemaDirectory", File.class);
Scanner ds = buildContext.newScanner( source ); // delta or full scanner
ds.scan();
String[] includedFiles = ds.getIncludedFiles();
if (includedFiles == null || includedFiles.length <= 0 )
{
return null;
}
// execute mojo
Set<IProject> result = super.build( kind, monitor );
// tell m2e builder to refresh generated files
File generated = maven.getMojoParameterValue(getSession(), getMojoExecution(), "dest", File.class);
if (generated != null) {
buildContext.refresh( generated );
}
return result;
}
开发者ID:qoswork,项目名称:opennmszh,代码行数:29,代码来源:CastorBuildParticipant.java
示例5: ConfiguratorContext
import org.eclipse.m2e.core.embedder.IMaven; //导入依赖的package包/类
public ConfiguratorContext(final IMaven maven, final IMavenProjectRegistry projectManager) {
this.maven = maven;
this.projectManager = projectManager;
}
开发者ID:maven-nar,项目名称:m2e-nar,代码行数:5,代码来源:ConfiguratorContext.java
示例6: getMaven
import org.eclipse.m2e.core.embedder.IMaven; //导入依赖的package包/类
public IMaven getMaven() {
return maven;
}
开发者ID:maven-nar,项目名称:m2e-nar,代码行数:4,代码来源:ConfiguratorContext.java
示例7: build
import org.eclipse.m2e.core.embedder.IMaven; //导入依赖的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
示例8: buildBundle
import org.eclipse.m2e.core.embedder.IMaven; //导入依赖的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
示例9: build
import org.eclipse.m2e.core.embedder.IMaven; //导入依赖的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();
ArtifactKey artifactKey = currentProject.getArtifactKey();
String shortArtifactKey = artifactKey.getGroupId()
+ ":" + artifactKey.getArtifactId()
+ ":" + artifactKey.getVersion();
log.debug("artifact key: {}", shortArtifactKey);
MavenProject mavenProject = currentProject.getMavenProject();
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,代码行数:67,代码来源:GenericBuildParticipant.java
示例10: build
import org.eclipse.m2e.core.embedder.IMaven; //导入依赖的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
注:本文中的org.eclipse.m2e.core.embedder.IMaven类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论