当前位置: 首页>>代码示例>>Java>>正文


Java MojoExecution.getLifecyclePhase方法代码示例

本文整理汇总了Java中org.apache.maven.plugin.MojoExecution.getLifecyclePhase方法的典型用法代码示例。如果您正苦于以下问题:Java MojoExecution.getLifecyclePhase方法的具体用法?Java MojoExecution.getLifecyclePhase怎么用?Java MojoExecution.getLifecyclePhase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.maven.plugin.MojoExecution的用法示例。


在下文中一共展示了MojoExecution.getLifecyclePhase方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: observeExecution

import org.apache.maven.plugin.MojoExecution; //导入方法依赖的package包/类
public void observeExecution( MojoExecution mojoExecution )
{
    String lifecyclePhase = mojoExecution.getLifecyclePhase();

    if ( lifecyclePhase != null )
    {
        if ( lastLifecyclePhase == null )
        {
            lastLifecyclePhase = lifecyclePhase;
        }
        else if ( !lifecyclePhase.equals( lastLifecyclePhase ) )
        {
            project.addLifecyclePhase( lastLifecyclePhase );
            lastLifecyclePhase = lifecyclePhase;
        }
    }

    if ( lastLifecyclePhase != null )
    {
        project.addLifecyclePhase( lastLifecyclePhase );
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:23,代码来源:PhaseRecorder.java

示例2: createExecutionPlanItem

import org.apache.maven.plugin.MojoExecution; //导入方法依赖的package包/类
public List<ExecutionPlanItem> createExecutionPlanItem( MavenProject mavenProject, List<MojoExecution> executions )
{
    BuilderCommon.attachToThread( mavenProject );

    List<ExecutionPlanItem> result = new ArrayList<ExecutionPlanItem>();
    for ( MojoExecution mojoExecution : executions )
    {
        String lifeCyclePhase = mojoExecution.getLifecyclePhase();
        final Scheduling scheduling = getScheduling( "default" );

        Schedule schedule = null;
        if ( scheduling != null )
        {
            schedule = scheduling.getSchedule( mojoExecution );
            if ( schedule == null )
            {
                schedule = scheduling.getSchedule( lifeCyclePhase );
            }
        }

        result.add( new ExecutionPlanItem( mojoExecution, schedule ) );
    }
    return result;
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:25,代码来源:DefaultSchedules.java

示例3: build

import org.apache.maven.plugin.MojoExecution; //导入方法依赖的package包/类
@Override
public Set<IProject> build(int kind, IProgressMonitor monitor) throws Exception {

	final MojoExecution mojoExecution = getMojoExecution();
	log.debug("execution: {}", mojoExecution);

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

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

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

	if ("bundle".equalsIgnoreCase(goal)) {
		return buildBundle(kind, monitor);
	} else if ("process".equalsIgnoreCase(goal)) {
		return buildProcess(kind, monitor);
	} else {
		return super.build(kind, monitor);
	}
}
 
开发者ID:dashie,项目名称:m2e-plugins,代码行数:25,代码来源:BuildParticipant.java

示例4: isDifferentPhase

import org.apache.maven.plugin.MojoExecution; //导入方法依赖的package包/类
public boolean isDifferentPhase( MojoExecution nextMojoExecution )
{
    String lifecyclePhase = nextMojoExecution.getLifecyclePhase();
    if ( lifecyclePhase == null )
    {
        return lastLifecyclePhase != null;
    }
    return !lifecyclePhase.equals( lastLifecyclePhase );

}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:11,代码来源:PhaseRecorder.java

示例5: createMojoKey

import org.apache.maven.plugin.MojoExecution; //导入方法依赖的package包/类
private MojoKey createMojoKey( MojoExecution mojo )
{
    return new MojoKey( mojo.getGroupId(), mojo.getArtifactId(), mojo.getVersion(), mojo.getGoal(),
                        mojo.getExecutionId(), mojo.getLifecyclePhase() );
}
 
开发者ID:khmarbaise,项目名称:maven-buildtime-profiler,代码行数:6,代码来源:MojoTimer.java

示例6: _handle

import org.apache.maven.plugin.MojoExecution; //导入方法依赖的package包/类
@Override
public boolean _handle(@Nonnull ExecutionEvent executionEvent) {
    List<String> configurationParameters = getConfigurationParametersToReport(executionEvent);

    Xpp3Dom root = new Xpp3Dom("ExecutionEvent");
    root.setAttribute("class", executionEvent.getClass().getName());
    root.setAttribute("type", executionEvent.getType().name());

    root.addChild(newElement("project", executionEvent.getProject()));

    MojoExecution execution = executionEvent.getMojoExecution();

    if (execution == null) {
        root.addChild(new Xpp3Dom("no-execution-found"));
    } else {
        Xpp3Dom plugin = new Xpp3Dom("plugin");
        root.addChild(plugin);

        plugin.setAttribute("groupId", execution.getGroupId());
        plugin.setAttribute("artifactId", execution.getArtifactId());
        plugin.setAttribute("goal", execution.getGoal());
        plugin.setAttribute("version", execution.getVersion());
        if (execution.getExecutionId() != null) {
            // See JENKINS-47508, caused by plugin being declared and invoked by the <reports> section
            plugin.setAttribute("executionId", execution.getExecutionId());
        }
        if (execution.getLifecyclePhase() != null) {
            // protect against null lifecyclePhase. cause is NOT clear
            plugin.setAttribute("lifecyclePhase", execution.getLifecyclePhase());
        }

        for (String configurationParameter : configurationParameters) {
            Xpp3Dom element = fullClone(configurationParameter, execution.getConfiguration().getChild(configurationParameter));
            if (element != null) {
                plugin.addChild(element);
            }
        }
    }

    addDetails(executionEvent, root);

    reporter.print(root);

    return true;
}
 
开发者ID:jenkinsci,项目名称:pipeline-maven-plugin,代码行数:46,代码来源:AbstractExecutionHandler.java

示例7: build

import org.apache.maven.plugin.MojoExecution; //导入方法依赖的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: build

import org.apache.maven.plugin.MojoExecution; //导入方法依赖的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

示例9: build

import org.apache.maven.plugin.MojoExecution; //导入方法依赖的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.apache.maven.plugin.MojoExecution.getLifecyclePhase方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。