• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java MojoExecution类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: MavenEnvironment

import org.apache.maven.plugin.MojoExecution; //导入依赖的package包/类
public MavenEnvironment(MavenSession aMavenSession, BuildPluginManager aBuildPluginManager, Log aLog,
        DependencyTreeBuilder aDependencyTreeBuilder, ArtifactRepository aLocalRepository,
        SecDispatcher aSecurityDispatcher, MavenProjectBuilder aProjectBuilder,
        LifecycleExecutor aLifecycleExecutor, ArtifactFactory aArtifactFactory,
        ArtifactMetadataSource aArtifactMetadataSource, ArtifactCollector aArtifactCollector, RuntimeInformation aRuntimeInformation,
        MojoExecution aExecution) {
    mavenSession = aMavenSession;
    buildPluginManager = aBuildPluginManager;
    log = aLog;
    dependencyTreeBuilder = aDependencyTreeBuilder;
    localRepository = aLocalRepository;
    securityDispatcher = aSecurityDispatcher;
    projectBuilder = aProjectBuilder;
    lifecycleExecutor = aLifecycleExecutor;
    artifactFactory = aArtifactFactory;
    artifactMetadataSource = aArtifactMetadataSource;
    artifactCollector = aArtifactCollector;
    runtimeInformation = aRuntimeInformation;
    mojoExecution = aExecution;
}
 
开发者ID:mirkosertic,项目名称:mavensonarsputnik,代码行数:21,代码来源:MavenEnvironment.java


示例2: executePluginDef

import org.apache.maven.plugin.MojoExecution; //导入依赖的package包/类
private void executePluginDef(InputStream is) throws Exception {
    Xpp3Dom pluginDef = Xpp3DomBuilder.build(is, "utf-8");
    Plugin plugin = loadPlugin(pluginDef);
    Xpp3Dom config = pluginDef.getChild("configuration");
    PluginDescriptor pluginDesc = pluginManager.loadPlugin(plugin, 
                                                           mavenProject.getRemotePluginRepositories(), 
                                                           mavenSession.getRepositorySession());
    Xpp3Dom executions = pluginDef.getChild("executions");
    
    for ( Xpp3Dom execution : executions.getChildren()) {
        Xpp3Dom goals = execution.getChild("goals");
        for (Xpp3Dom goal : goals.getChildren()) {
            MojoDescriptor desc = pluginDesc.getMojo(goal.getValue());
            pluginManager.executeMojo(mavenSession, new MojoExecution(desc, config));
        }
    }
}
 
开发者ID:apache,项目名称:karaf-boot,代码行数:18,代码来源:GenerateMojo.java


示例3: setUp

import org.apache.maven.plugin.MojoExecution; //导入依赖的package包/类
@Before
public void setUp() {
  logOutput = mock(LogOutput.class);
  runtimeInformation = mock(RuntimeInformation.class, Mockito.RETURNS_DEEP_STUBS);
  mavenSession = mock(MavenSession.class);
  rootProject = mock(MavenProject.class);
  mojoExecution = mock(MojoExecution.class);
  envProps = new Properties();

  Properties system = new Properties();
  system.put("system", "value");
  system.put("user", "value");
  Properties root = new Properties();
  root.put("root", "value");
  envProps.put("env", "value");

  when(mojoExecution.getVersion()).thenReturn("2.0");
  when(runtimeInformation.getMavenVersion()).thenReturn("1.0");
  when(mavenSession.getSystemProperties()).thenReturn(system);
  when(mavenSession.getUserProperties()).thenReturn(new Properties());
  when(mavenSession.getSettings()).thenReturn(new Settings());
  when(rootProject.getProperties()).thenReturn(root);
  when(mavenSession.getCurrentProject()).thenReturn(rootProject);
  propertyDecryptor = new PropertyDecryptor(mock(Log.class), mock(SecDispatcher.class));
}
 
开发者ID:SonarSource,项目名称:sonar-scanner-maven,代码行数:26,代码来源:ScannerFactoryTest.java


示例4: testClean

import org.apache.maven.plugin.MojoExecution; //导入依赖的package包/类
@Test
public void testClean() throws Exception {

   final Xpp3Dom cleanConfig = Xpp3DomBuilder.build( SetUpMojoTest.class.getResourceAsStream( "setup-clean-mojo-config.xml" ), "UTF-8" );
   cleanConfig.getChild( "filesets" ).getChild( 0 ).getChild( "directory" ).setValue( helper.workingDir.getCanonicalPath() );

   doAnswer( new Answer<Void>() {
      @Override
      public Void answer( InvocationOnMock invocation ) throws Throwable {
         assertEquals( cleanConfig, ((MojoExecution) invocation.getArguments()[1]).getConfiguration() );
         return null;
      }
   } ).when( mojo.pluginManager ).executeMojo( eq( mojo.session ), any( MojoExecution.class ) );

   mojo.clean();
}
 
开发者ID:ZsZs,项目名称:FitNesseLauncher,代码行数:17,代码来源:SetUpMojoTest.java


示例5: testUnpack

import org.apache.maven.plugin.MojoExecution; //导入依赖的package包/类
@Test
public void testUnpack() throws Exception {
   final Xpp3Dom unpackConfig = Xpp3DomBuilder.build( SetUpMojoTest.class.getResourceAsStream( "unpack-mojo-config.xml" ), "UTF-8" );
   unpackConfig.getChild( "artifactItems" ).getChild( 0 ).getChild( "outputDirectory" ).setValue( helper.workingDir.getCanonicalPath() );
   unpackConfig.getChild( "artifactItems" ).getChild( 1 ).getChild( "outputDirectory" ).setValue( helper.workingDir.getCanonicalPath() + "/FitNesseRoot/files" );

   doAnswer( new Answer<Void>() {
      @Override
      public Void answer( InvocationOnMock invocation ) throws Throwable {
         assertEquals( unpackConfig, ((MojoExecution) invocation.getArguments()[1]).getConfiguration() );
         return null;
      }
   } ).when( mojo.pluginManager ).executeMojo( eq( mojo.session ), any( MojoExecution.class ) );

   mojo.unpack();
}
 
开发者ID:ZsZs,项目名称:FitNesseLauncher,代码行数:17,代码来源:SetUpMojoTest.java


示例6: testMove

import org.apache.maven.plugin.MojoExecution; //导入依赖的package包/类
@Test
public void testMove() throws Exception {

   final Xpp3Dom antrunConfig = Xpp3DomBuilder.build( SetUpMojoTest.class.getResourceAsStream( "antrun-mojo-config.xml" ), "UTF-8" );
   // Because the tmp directory differs by OS
   antrunConfig.getChild( "target" ).getChild( 0 ).setAttribute( "todir", helper.workingDir.getCanonicalPath() );
   antrunConfig.getChild( "target" ).getChild( 0 ).setAttribute( "file", helper.workingDir.getCanonicalPath() + "/" + SetUpMojo.FIT_ROOT );
   antrunConfig.getChild( "target" ).getChild( 1 ).setAttribute( "todir", helper.workingDir.getCanonicalPath() + "/" + FitNesseHelper.DEFAULT_ROOT + "/files" );
   antrunConfig.getChild( "target" ).getChild( 1 ).getChild( "fileset" ).setAttribute( "dir",
         helper.workingDir.getCanonicalPath() + "/" + FitNesseHelper.DEFAULT_ROOT + "/files/" + SetUpMojo.FIT_FILES );

   doAnswer( new Answer<Void>() {
      @Override
      public Void answer( InvocationOnMock invocation ) throws Throwable {
         assertEquals( antrunConfig, ((MojoExecution) invocation.getArguments()[1]).getConfiguration() );
         return null;
      }
   } ).when( mojo.pluginManager ).executeMojo( eq( mojo.session ), any( MojoExecution.class ) );

   mojo.move();
}
 
开发者ID:ZsZs,项目名称:FitNesseLauncher,代码行数:22,代码来源:SetUpMojoTest.java


示例7: testExecute

import org.apache.maven.plugin.MojoExecution; //导入依赖的package包/类
@Test
public void testExecute() throws Exception {
   final Xpp3Dom cleanConfig = Xpp3DomBuilder.build( TearDownMojoTest.class.getResourceAsStream( "teardown-clean-mojo-config.xml" ), "UTF-8" );

   doAnswer( new Answer<Void>() {
      @Override
      public Void answer( InvocationOnMock invocation ) throws Throwable {
         assertEquals( cleanConfig, ((MojoExecution) invocation.getArguments()[1]).getConfiguration() );
         return null;
      }
   } ).when( helper.mojo.pluginManager ).executeMojo( eq( helper.mojo.session ), any( MojoExecution.class ) );

   helper.mojo.execute();

   verify( helper.mojo.pluginManager, times( 1 ) ).executeMojo( eq( helper.mojo.session ), any( MojoExecution.class ) );
}
 
开发者ID:ZsZs,项目名称:FitNesseLauncher,代码行数:17,代码来源:TearDownMojoTest.java


示例8: dispatchBuildPluginManagerMethodCall

import org.apache.maven.plugin.MojoExecution; //导入依赖的package包/类
private Object dispatchBuildPluginManagerMethodCall( Object proxy, Method method, Object[] args )
    throws Throwable
{
    Object ret = method.invoke( mavenPluginManager, args );

    if ( method.getName().equals( "getConfiguredMojo" ) )
    {
        beforeMojoExecution( ret, (MojoExecution) args[2] );
    }
    else if ( method.getName().equals( "releaseMojo" ) )
    {
        afterMojoExecution( args[0], (MojoExecution) args[1], legacySupport.getSession().getCurrentProject() );
    }

    return ret;
}
 
开发者ID:fedora-java,项目名称:xmvn,代码行数:17,代码来源:XMvnMojoExecutionListener.java


示例9: getConfigurationParametersToReport

import org.apache.maven.plugin.MojoExecution; //导入依赖的package包/类
@Nonnull
@Override
protected List<String> getConfigurationParametersToReport(ExecutionEvent executionEvent) {

    MojoExecution mojoExecution = executionEvent.getMojoExecution();
    if (mojoExecution == null) {
        return Collections.emptyList();
    }

    Xpp3Dom configuration = mojoExecution.getConfiguration();
    List<String> parameters = new ArrayList<String>();
    for (Xpp3Dom configurationParameter : configuration.getChildren()) {
        parameters.add(configurationParameter.getName());
    }
    return parameters;
}
 
开发者ID:jenkinsci,项目名称:pipeline-maven-plugin,代码行数:17,代码来源:CatchAllExecutionHandler.java


示例10: 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


示例11: getExecutions

import org.apache.maven.plugin.MojoExecution; //导入依赖的package包/类
public static List<MojoExecution> getExecutions(final String goal, final ConfiguratorContext context, final IMavenProjectFacade facade,
		final IProgressMonitor monitor) throws CoreException {
	final List<MojoExecution> compileExecutions = new ArrayList<MojoExecution>();

	final Map<String, Set<MojoExecutionKey>> configuratorExecutions = AbstractProjectConfigurator.getConfiguratorExecutions(facade);

	final Set<MojoExecutionKey> executionKeys = configuratorExecutions.get(CProjectConfigurator.CONFIGURATOR_ID);
	if (executionKeys != null) {
		for (MojoExecutionKey key : executionKeys) {
			final MojoExecution mojoExecution = facade.getMojoExecution(key, monitor);
			if (goal.equals(mojoExecution.getGoal())) {
				compileExecutions.add(mojoExecution);
			}
		}
	}

	return compileExecutions;
}
 
开发者ID:maven-nar,项目名称:m2e-nar,代码行数:19,代码来源:MavenUtils.java


示例12: testBasic_skip

import org.apache.maven.plugin.MojoExecution; //导入依赖的package包/类
@Test
public void testBasic_skip() throws Exception {
  File basedir = compile("compile/basic");
  File testClasses = new File(basedir, "target/test-classes");

  MavenProject project = mojos.readMavenProject(basedir);
  MavenSession session = mojos.newMavenSession(project);
  MojoExecution execution = mojos.newMojoExecution("testCompile");
  execution.getConfiguration().addChild(newParameter("compilerId", compilerId));
  execution.getConfiguration().addChild(newParameter("skip", "true"));
  mojos.executeMojo(session, project, execution);
  mojos.assertBuildOutputs(testClasses, new String[0]);

  execution = mojos.newMojoExecution("testCompile");
  execution.getConfiguration().addChild(newParameter("compilerId", compilerId));
  mojos.executeMojo(session, project, execution);
  mojos.assertBuildOutputs(testClasses, "basic/BasicTest.class");

  execution = mojos.newMojoExecution("testCompile");
  execution.getConfiguration().addChild(newParameter("compilerId", compilerId));
  execution.getConfiguration().addChild(newParameter("skip", "true"));
  mojos.executeMojo(session, project, execution);
  mojos.assertBuildOutputs(testClasses, new String[0]);
  mojos.assertDeletedOutputs(testClasses, new String[0]);
}
 
开发者ID:takari,项目名称:takari-lifecycle,代码行数:26,代码来源:CompileTest.java


示例13: testImplicitClassfileGeneration

import org.apache.maven.plugin.MojoExecution; //导入依赖的package包/类
@Test
public void testImplicitClassfileGeneration() throws Exception {
  // javac automatically generates class files from sources found on classpath in some cases
  // the point of this test is to make sure this behaviour is disabled

  File dependency = compile("compile/basic");
  cp(dependency, "src/main/java/basic/Basic.java", "target/classes/basic/Basic.java");
  touch(dependency, "target/classes/basic/Basic.java"); // must be newer than .class file

  File basedir = resources.getBasedir("compile/implicit-classfile");
  MavenProject project = mojos.readMavenProject(basedir);
  MavenSession session = mojos.newMavenSession(project);
  MojoExecution execution = mojos.newMojoExecution();

  addDependency(project, "dependency", new File(dependency, "target/classes"));

  mojos.executeMojo(session, project, execution);

  mojos.assertBuildOutputs(new File(basedir, "target/classes"), "implicit/Implicit.class");
}
 
开发者ID:takari,项目名称:takari-lifecycle,代码行数:21,代码来源:CompileTest.java


示例14: processAnnotations

import org.apache.maven.plugin.MojoExecution; //导入依赖的package包/类
protected void processAnnotations(MavenSession session, MavenProject project, String goal, File processor, Proc proc, Xpp3Dom... parameters) throws Exception {
  MojoExecution execution = mojos.newMojoExecution(goal);

  addDependency(project, "processor", new File(processor, "target/classes"));

  Xpp3Dom configuration = execution.getConfiguration();

  if (proc != null) {
    configuration.addChild(newParameter("proc", proc.name()));
  }
  if (parameters != null) {
    for (Xpp3Dom parameter : parameters) {
      configuration.addChild(parameter);
    }
  }

  mojos.executeMojo(session, project, execution);
}
 
开发者ID:takari,项目名称:takari-lifecycle,代码行数:19,代码来源:AnnotationProcessingTest.java


示例15: resources_skip

import org.apache.maven.plugin.MojoExecution; //导入依赖的package包/类
@Test
public void resources_skip() throws Exception {
  File basedir = resources.getBasedir("resources/project-with-resources");
  File resource = new File(basedir, "target/classes/resource.txt");

  MavenProject project = mojos.readMavenProject(basedir);
  MavenSession session = mojos.newMavenSession(project);

  MojoExecution execution = mojos.newMojoExecution("process-resources");
  execution.getConfiguration().addChild(newParameter("skip", "true"));
  mojos.executeMojo(session, project, execution);
  Assert.assertFalse(resource.exists());

  mojos.executeMojo(basedir, "process-resources");
  Assert.assertTrue(resource.exists());

  execution = mojos.newMojoExecution("process-resources");
  execution.getConfiguration().addChild(newParameter("skip", "true"));
  mojos.executeMojo(session, project, execution);
  Assert.assertTrue(resource.exists());
}
 
开发者ID:takari,项目名称:takari-lifecycle,代码行数:22,代码来源:ResourcesTest.java


示例16: 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


示例17: 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


示例18: getResourceBundles

import org.apache.maven.plugin.MojoExecution; //导入依赖的package包/类
/**
 * 
 * @param mavenProjectFacade
 * @return
 */
private Set<String> getResourceBundles(IMavenProjectFacade mavenProjectFacade, IProgressMonitor monitor) throws CoreException {
	Set<String> bundles = new HashSet<String>();
	List<MojoExecution> executions = mavenProjectFacade.getMojoExecutions(Activator.MAVEN_GROUP_ID, Activator.MAVEN_ARTIFACT_ID, monitor, "process");
	for (MojoExecution execution : executions) {
		Xpp3Dom node = execution.getConfiguration();
		if (node != null) {
			node = node.getChild("resourceBundles");
			if (node != null) {
				Xpp3Dom[] nodes = node.getChildren("resourceBundle");
				if (nodes != null) {
					for (Xpp3Dom n : nodes) {
						String bundle = n.getValue();
						bundles.add(bundle);
					}
				}
			}
		}
	}
	return bundles;
}
 
开发者ID:dashie,项目名称:m2e-plugins,代码行数:26,代码来源:Configurator.java


示例19: 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


示例20: 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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Scaling类代码示例发布时间:2022-05-20
下一篇:
Java ActivationConfigProperty类代码示例发布时间:2022-05-20
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap