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


Java MojoExecution.getMojoDescriptor方法代码示例

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


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

示例1: NarTestCompileBuildParticipant

import org.apache.maven.plugin.MojoExecution; //导入方法依赖的package包/类
public NarTestCompileBuildParticipant(MojoExecution execution, boolean runOnIncremental, boolean runOnConfiguration) {
	super(new MojoExecution(execution.getMojoDescriptor(), execution.getExecutionId(), execution.getSource()), runOnIncremental, runOnConfiguration);
	// Some versions of nar-maven-plugin don't have a nar-test-unpack goal
	// this means the test artifacts won't be available to us.
	// What we need to do is run the nar-testCompile goal without any tests
	// its configuration in order to just unpack.
	Xpp3Dom configuration = new Xpp3Dom(execution.getConfiguration());
	logger.debug("Configuration before: " + configuration);
	for (int i = 0; i < configuration.getChildCount(); ++i) {
		if ("tests".equals(configuration.getChild(i).getName())) {
			configuration.removeChild(i);
			break;
		}
	}
	logger.debug("Configuration after: " + configuration);
	getMojoExecution().setConfiguration(configuration);
}
 
开发者ID:maven-nar,项目名称:m2e-nar,代码行数:18,代码来源:NarTestCompileBuildParticipant.java

示例2: setupMojoExecution

import org.apache.maven.plugin.MojoExecution; //导入方法依赖的package包/类
public void setupMojoExecution( MavenSession session, MavenProject project, MojoExecution mojoExecution )
    throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
    MojoNotFoundException, InvalidPluginDescriptorException, NoPluginFoundForPrefixException,
    LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException
{
    MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();

    if ( mojoDescriptor == null )
    {
        mojoDescriptor =
            pluginManager.getMojoDescriptor( mojoExecution.getPlugin(), mojoExecution.getGoal(),
                                             project.getRemotePluginRepositories(),
                                             session.getRepositorySession() );

        mojoExecution.setMojoDescriptor( mojoDescriptor );
    }

    populateMojoExecutionConfiguration( project, mojoExecution,
                                        MojoExecution.Source.CLI.equals( mojoExecution.getSource() ) );

    finalizeMojoConfiguration( mojoExecution );

    calculateForkedExecutions( mojoExecution, session, project, new HashSet<MojoDescriptor>() );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:25,代码来源:DefaultLifecycleExecutionPlanCalculator.java

示例3: debugDependencyRequirements

import org.apache.maven.plugin.MojoExecution; //导入方法依赖的package包/类
private void debugDependencyRequirements( List<MojoExecution> mojoExecutions )
{
    Set<String> scopesToCollect = new TreeSet<String>();
    Set<String> scopesToResolve = new TreeSet<String>();

    for ( MojoExecution mojoExecution : mojoExecutions )
    {
        MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();

        String scopeToCollect = mojoDescriptor.getDependencyCollectionRequired();
        if ( StringUtils.isNotEmpty( scopeToCollect ) )
        {
            scopesToCollect.add( scopeToCollect );
        }

        String scopeToResolve = mojoDescriptor.getDependencyResolutionRequired();
        if ( StringUtils.isNotEmpty( scopeToResolve ) )
        {
            scopesToResolve.add( scopeToResolve );
        }
    }

    logger.debug( "Dependencies (collect): " + scopesToCollect );
    logger.debug( "Dependencies (resolve): " + scopesToResolve );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:26,代码来源:LifecycleDebugLogger.java

示例4: compile

import org.apache.maven.plugin.MojoExecution; //导入方法依赖的package包/类
private void compile(File basedir, File processor, String executionId) throws Exception {
  MavenProject project = mojos.readMavenProject(basedir);
  MavenSession session = mojos.newMavenSession(project);
  MojoExecution execution = mojos.newMojoExecution();
  MojoExecution cloned = new MojoExecution(execution.getMojoDescriptor(), executionId, null);
  cloned.setConfiguration(execution.getConfiguration());
  execution.getConfiguration().addChild(newParameter("proc", Proc.none.name()));
  addDependency(project, "processor", new File(processor, "target/classes"));
  mojos.executeMojo(session, project, cloned);
}
 
开发者ID:takari,项目名称:takari-lifecycle,代码行数:11,代码来源:AnnotationProcessingTest.java

示例5: collectDependencyRequirements

import org.apache.maven.plugin.MojoExecution; //导入方法依赖的package包/类
private void collectDependencyRequirements( Set<String> scopesToResolve, Set<String> scopesToCollect,
                                            Collection<MojoExecution> mojoExecutions )
{
    for ( MojoExecution mojoExecution : mojoExecutions )
    {
        MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();

        scopesToResolve.addAll( toScopes( mojoDescriptor.getDependencyResolutionRequired() ) );

        scopesToCollect.addAll( toScopes( mojoDescriptor.getDependencyCollectionRequired() ) );
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:13,代码来源:MojoExecutor.java

示例6: calculateForkedGoal

import org.apache.maven.plugin.MojoExecution; //导入方法依赖的package包/类
private List<MojoExecution> calculateForkedGoal( MojoExecution mojoExecution, MavenSession session,
                                                 MavenProject project,
                                                 Collection<MojoDescriptor> alreadyForkedExecutions )
    throws MojoNotFoundException, PluginNotFoundException, PluginResolutionException,
    PluginDescriptorParsingException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
    LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException
{
    MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();

    PluginDescriptor pluginDescriptor = mojoDescriptor.getPluginDescriptor();

    String forkedGoal = mojoDescriptor.getExecuteGoal();

    MojoDescriptor forkedMojoDescriptor = pluginDescriptor.getMojo( forkedGoal );
    if ( forkedMojoDescriptor == null )
    {
        throw new MojoNotFoundException( forkedGoal, pluginDescriptor );
    }

    if ( alreadyForkedExecutions.contains( forkedMojoDescriptor ) )
    {
        return Collections.emptyList();
    }

    MojoExecution forkedExecution = new MojoExecution( forkedMojoDescriptor, forkedGoal );

    populateMojoExecutionConfiguration( project, forkedExecution, true );

    finalizeMojoConfiguration( forkedExecution );

    calculateForkedExecutions( forkedExecution, session, project, alreadyForkedExecutions );

    return Collections.singletonList( forkedExecution );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:35,代码来源:DefaultLifecycleExecutionPlanCalculator.java

示例7: beforeProjectLifecycleExecution

import org.apache.maven.plugin.MojoExecution; //导入方法依赖的package包/类
@Override
public void beforeProjectLifecycleExecution(ProjectExecutionEvent event) throws LifecycleExecutionException {
    final MavenProject project = event.getProject();
    log.info("srcdeps enforcer checks for violations in {}:{}", project.getGroupId(), project.getArtifactId());

    final Maven maven = configurationProducer.getConfiguration().getMaven();

    final List<MojoExecution> mojoExecutions = event.getExecutionPlan();
    final List<String> goals = new ArrayList<>(mojoExecutions.size());
    for (MojoExecution mojoExecution : mojoExecutions) {
        MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
        goals.add(mojoDescriptor.getFullGoalName());
        goals.add(mojoDescriptor.getGoal());
    }

    final List<String> profiles = new ArrayList<>();
    final List<Profile> activeProfiles = project.getActiveProfiles();
    for (Profile profile : activeProfiles) {
        final String id = profile.getId();
        profiles.add(id);
    }

    final Properties props = new Properties();
    props.putAll(project.getProperties());
    props.putAll(System.getProperties());

    String[] firstViolation = assertFailWithout(maven.getFailWithout(), goals, profiles, props);
    if (firstViolation == null) {
        firstViolation = assertFailWith(maven.getFailWith(), goals, profiles, props);
    }
    if (firstViolation != null) {
        /* check if there are srcdeps */
        Artifact parent = project.getParentArtifact();
        if (parent != null) {
            assertNotSrcdeps(parent.getGroupId(), parent.getArtifactId(), parent.getVersion(), firstViolation);
        }
        DependencyManagement dm;
        List<Dependency> deps;
        if ((dm = project.getDependencyManagement()) != null && (deps = dm.getDependencies()) != null) {
            assertNotSrcdeps(deps, firstViolation);
        }
        if ((deps = project.getDependencies()) != null) {
            assertNotSrcdeps(deps, firstViolation);
        }
    }
}
 
开发者ID:srcdeps,项目名称:srcdeps-maven,代码行数:47,代码来源:SrcdepsEnforcer.java

示例8: calculateForkedExecutions

import org.apache.maven.plugin.MojoExecution; //导入方法依赖的package包/类
private void calculateForkedExecutions( MojoExecution mojoExecution, MavenSession session, MavenProject project,
                                        Collection<MojoDescriptor> alreadyForkedExecutions )
    throws MojoNotFoundException, PluginNotFoundException, PluginResolutionException,
    PluginDescriptorParsingException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
    LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException
{
    MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();

    if ( !mojoDescriptor.isForking() )
    {
        return;
    }

    if ( !alreadyForkedExecutions.add( mojoDescriptor ) )
    {
        return;
    }

    List<MavenProject> forkedProjects =
        LifecycleDependencyResolver.getProjects( project, session, mojoDescriptor.isAggregator() );

    for ( MavenProject forkedProject : forkedProjects )
    {
        if ( forkedProject != project )
        {
            lifecyclePluginResolver.resolveMissingPluginVersions( forkedProject, session );
        }

        List<MojoExecution> forkedExecutions;

        if ( StringUtils.isNotEmpty( mojoDescriptor.getExecutePhase() ) )
        {
            forkedExecutions =
                calculateForkedLifecycle( mojoExecution, session, forkedProject, alreadyForkedExecutions );
        }
        else
        {
            forkedExecutions =
                calculateForkedGoal( mojoExecution, session, forkedProject, alreadyForkedExecutions );
        }

        mojoExecution.setForkedExecutions( BuilderCommon.getKey( forkedProject ), forkedExecutions );
    }

    alreadyForkedExecutions.remove( mojoDescriptor );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:47,代码来源:DefaultLifecycleExecutionPlanCalculator.java


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