當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。