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


Java MojoExecution类代码示例

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


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


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