當前位置: 首頁>>代碼示例>>Java>>正文


Java PluginDescriptor類代碼示例

本文整理匯總了Java中org.apache.maven.plugin.descriptor.PluginDescriptor的典型用法代碼示例。如果您正苦於以下問題:Java PluginDescriptor類的具體用法?Java PluginDescriptor怎麽用?Java PluginDescriptor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PluginDescriptor類屬於org.apache.maven.plugin.descriptor包,在下文中一共展示了PluginDescriptor類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: init

import org.apache.maven.plugin.descriptor.PluginDescriptor; //導入依賴的package包/類
static AgentDependencies init(PluginDescriptor pluginDescriptor) throws MojoExecutionException {

        String pluginGroupId = pluginDescriptor.getGroupId();
        String pluginArtifactId = pluginDescriptor.getArtifactId();

        List<ExpectedDependency> expectedDependencies = Arrays.asList(
                new ExpectedDependency(pluginGroupId, "promagent-agent"),
                new ExpectedDependency(pluginGroupId, "promagent-internal"),
                new ExpectedDependency(pluginGroupId, "promagent-api"),
                new ExpectedDependency("io.prometheus", "simpleclient_common"),
                new ExpectedDependency("io.prometheus", "simpleclient"),
                new ExpectedDependency("net.bytebuddy", "byte-buddy"),
                new ExpectedDependency("commons-io", "commons-io")
        );

        List<Artifact> actualDependencies = resolveVersions(pluginDescriptor, pluginArtifactId, expectedDependencies);
        failUnlessComplete(actualDependencies, expectedDependencies, pluginArtifactId);
        return new AgentDependencies(pluginGroupId, actualDependencies);
    }
 
開發者ID:fstab,項目名稱:promagent,代碼行數:20,代碼來源:AgentDependencies.java

示例2: getWorkflowDescriptor

import org.apache.maven.plugin.descriptor.PluginDescriptor; //導入依賴的package包/類
public static InputStream getWorkflowDescriptor(String goalName, PluginDescriptor pluginDescriptor,
    Optional<File> customWorkflowDescriptor, Logger log) throws MojoExecutionException {
  log.info("Constructing workflow for processing");
  String goalPrefix = pluginDescriptor.getGoalPrefix();

  if (customWorkflowDescriptor.isPresent()) {
    File customDescriptor = customWorkflowDescriptor.get();
    log.debug("Requested overriding of workflow with file: " + customDescriptor.getAbsolutePath());

    if (customDescriptor.exists() && customDescriptor.isFile()) {
      try {
        log.info("Workflow of goal '" + goalPrefix + ':' + goalName + "' will be overriden by file '"
            + customDescriptor.getAbsolutePath() + "'.");
        return new FileInputStream(customDescriptor);
      } catch (Exception e) {
        throw new MojoExecutionException("Unable to load custom workflow for goal " + goalName, e);
      }
    } else {
      throw new MojoExecutionException("Unable to load custom workflow for goal " + goalPrefix + ':' + goalName
          + ". The workflow file '" + customDescriptor.getAbsolutePath() + "' does not exist!");
    }
  }

  log.info("Goal '" + goalPrefix + ':' + goalName + "' will use default workflow packaged with the plugin.");
  return Thread.currentThread().getContextClassLoader().getResourceAsStream(DEFAULT_WORKFLOW_DIR + "/" + goalName);
}
 
開發者ID:shillner,項目名稱:maven-cdi-plugin-utils,代碼行數:27,代碼來源:WorkflowUtil.java

示例3: executePluginDef

import org.apache.maven.plugin.descriptor.PluginDescriptor; //導入依賴的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

示例4: PlanContext

import org.apache.maven.plugin.descriptor.PluginDescriptor; //導入依賴的package包/類
/** */
public PlanContext(
    ProcessRunner processRunner,
    PluginDescriptor pluginDescriptor,
    BuildContext buildContext,
    Log log,
    SrcfilesDirs srcfilesDirs,
    GenfilesDirs genfilesDirs,
    ImmutableList<Artifact> artifacts,
    File outputDir,
    File projectBuildOutputDirectory,
    File closureOutputDirectory,
    StableCssSubstitutionMapProvider substitutionMapProvider) {
  this.processRunner = processRunner;
  this.pluginDescriptor = pluginDescriptor;
  this.buildContext = buildContext;
  this.log = log;
  this.srcfilesDirs = srcfilesDirs;
  this.genfilesDirs = genfilesDirs;
  this.artifacts = artifacts;
  this.outputDir = outputDir;
  this.projectBuildOutputDirectory = projectBuildOutputDirectory;
  this.closureOutputDirectory = closureOutputDirectory;
  this.substitutionMapProvider = substitutionMapProvider;
}
 
開發者ID:mikesamuel,項目名稱:closure-maven-plugin,代碼行數:26,代碼來源:PlanContext.java

示例5: SetupsMojoTestHelper

import org.apache.maven.plugin.descriptor.PluginDescriptor; //導入依賴的package包/類
public SetupsMojoTestHelper( AbstractSetupsMojo mojo ) throws IOException {
   this.workingDir = new File( System.getProperty( "java.io.tmpdir" ), "unit_test_working" );

   this.mojo = mojo;

   this.mojo.workingDir = this.workingDir.getCanonicalPath();
   this.mojo.root = FitNesseHelper.DEFAULT_ROOT;
   this.mojo.project = new MavenProject();
   this.mojo.project.setFile( new File( getClass().getResource( "pom.xml" ).getPath() ) );
   this.mojo.pluginDescriptor = new PluginDescriptor();
   this.mojo.pluginManager = mock( BuildPluginManager.class );
   this.mojo.session = mock( MavenSession.class );

   this.logStream = new ByteArrayOutputStream();
   this.mojo.setLog( new DefaultLog( new PrintStreamLogger( Logger.LEVEL_INFO, "test", new PrintStream( this.logStream ) ) ) );
}
 
開發者ID:ZsZs,項目名稱:FitNesseLauncher,代碼行數:17,代碼來源:SetupsMojoTestHelper.java

示例6: setupArtifact

import org.apache.maven.plugin.descriptor.PluginDescriptor; //導入依賴的package包/類
@SuppressWarnings( "unchecked" )
void setupArtifact( String groupId, String artifactId, String goal, String type )
      throws DuplicateMojoDescriptorException, PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException, InvalidPluginDescriptorException {

   DefaultArtifact artifact = new DefaultArtifact( groupId, artifactId, "DUMMY", "compile", type, "", null );
   MojoDescriptor mojoDescriptor = new MojoDescriptor();
   mojoDescriptor.setGoal( goal );
   PluginDescriptor pluginDescriptor = new PluginDescriptor();
   pluginDescriptor.addMojo( mojoDescriptor );

   Plugin plugin = new Plugin();
   plugin.setGroupId( groupId );
   plugin.setArtifactId( artifactId );

   when( this.mojo.pluginManager.loadPlugin( eq( plugin ), anyList(), any( RepositorySystemSession.class ) ) ).thenReturn( pluginDescriptor );

   this.mojo.pluginDescriptor.getArtifactMap().put( String.format( "%s:%s", groupId, artifactId ), artifact );
}
 
開發者ID:ZsZs,項目名稱:FitNesseLauncher,代碼行數:19,代碼來源:SetupsMojoTestHelper.java

示例7: extractionOfMojoSpecificConfigurationAndMergingwithDefaultMojoConfiguration

import org.apache.maven.plugin.descriptor.PluginDescriptor; //導入依賴的package包/類
@Test
public void extractionOfMojoSpecificConfigurationAndMergingwithDefaultMojoConfiguration() throws Exception {
  InputStream is = getClass().getResourceAsStream("/META-INF/maven/plugin.xml");
  assertNotNull(is);
  PluginDescriptor pluginDescriptor = pluginDescriptorBuilder.build(new InputStreamReader(is, "UTF-8"));
  String goal = merger.determineGoal("io.takari.maven.plugins.jar.Jar", pluginDescriptor);
  assertEquals("We expect the goal name to be 'jar'", "jar", goal);
  MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo(goal);
  PlexusConfiguration defaultMojoConfiguration = mojoDescriptor.getMojoConfiguration();
  System.out.println(defaultMojoConfiguration);

  PlexusConfiguration configurationFromMaven = builder("configuration") //
      .es("jar") //
      .es("sourceJar").v("true").ee() //
      .ee() //
      .buildPlexusConfiguration();

  PlexusConfiguration mojoConfiguration = merger.extractAndMerge(goal, configurationFromMaven, defaultMojoConfiguration);

  String xml = mojoConfiguration.toString();
  assertXpathEvaluatesTo("java.io.File", "/configuration/classesDirectory/@implementation", xml);
  assertXpathEvaluatesTo("${project.build.outputDirectory}", "/configuration/classesDirectory/@default-value", xml);
  assertXpathEvaluatesTo("java.util.List", "/configuration/reactorProjects/@implementation", xml);
  assertXpathEvaluatesTo("${reactorProjects}", "/configuration/reactorProjects/@default-value", xml);
  assertXpathEvaluatesTo("true", "/configuration/sourceJar", xml);
}
 
開發者ID:takari,項目名稱:takari-lifecycle,代碼行數:27,代碼來源:MojoConfigurationMergerTest.java

示例8: executeMojo

import org.apache.maven.plugin.descriptor.PluginDescriptor; //導入依賴的package包/類
/**
 * Taken from MojoExecutor of Don Brown. Make it working with Maven 3.1.
 * 
 * @param plugin
 * @param goal
 * @param configuration
 * @param env
 * @throws MojoExecutionException
 * @throws PluginResolutionException
 * @throws PluginDescriptorParsingException
 * @throws InvalidPluginDescriptorException
 * @throws PluginManagerException
 * @throws PluginConfigurationException
 * @throws MojoFailureException
 */
private void executeMojo( Plugin plugin, String goal, Xpp3Dom configuration )
    throws MojoExecutionException, PluginResolutionException, PluginDescriptorParsingException,
    InvalidPluginDescriptorException, MojoFailureException, PluginConfigurationException, PluginManagerException
{

    if ( configuration == null )
    {
        throw new NullPointerException( "configuration may not be null" );
    }

    PluginDescriptor pluginDescriptor = getPluginDescriptor( plugin );

    MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo( goal );
    if ( mojoDescriptor == null )
    {
        throw new MojoExecutionException( "Could not find goal '" + goal + "' in plugin " + plugin.getGroupId()
            + ":" + plugin.getArtifactId() + ":" + plugin.getVersion() );
    }

    MojoExecution exec = mojoExecution( mojoDescriptor, configuration );
    pluginManager.executeMojo( getMavenSession(), exec );
}
 
開發者ID:khmarbaise,項目名稱:iterator-maven-plugin,代碼行數:38,代碼來源:IteratorMojo.java

示例9: getMojoDescriptor

import org.apache.maven.plugin.descriptor.PluginDescriptor; //導入依賴的package包/類
public MojoDescriptor getMojoDescriptor( Plugin plugin, String goal, List<RemoteRepository> repositories,
                                         RepositorySystemSession session )
    throws MojoNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
    InvalidPluginDescriptorException
{
    PluginDescriptor pluginDescriptor = getPluginDescriptor( plugin, repositories, session );

    MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo( goal );

    if ( mojoDescriptor == null )
    {
        throw new MojoNotFoundException( goal, pluginDescriptor );
    }

    return mojoDescriptor;
}
 
開發者ID:gems-uff,項目名稱:oceano,代碼行數:17,代碼來源:DefaultMavenPluginManager.java

示例10: checkRequiredMavenVersion

import org.apache.maven.plugin.descriptor.PluginDescriptor; //導入依賴的package包/類
public void checkRequiredMavenVersion( PluginDescriptor pluginDescriptor )
    throws PluginIncompatibleException
{
    String requiredMavenVersion = pluginDescriptor.getRequiredMavenVersion();
    if ( StringUtils.isNotBlank( requiredMavenVersion ) )
    {
        try
        {
            if ( !runtimeInformation.isMavenVersion( requiredMavenVersion ) )
            {
                throw new PluginIncompatibleException( pluginDescriptor.getPlugin(), "The plugin "
                    + pluginDescriptor.getId() + " requires Maven version " + requiredMavenVersion );
            }
        }
        catch ( RuntimeException e )
        {
            logger.warn( "Could not verify plugin's Maven prerequisite: " + e.getMessage() );
        }
    }
}
 
開發者ID:gems-uff,項目名稱:oceano,代碼行數:21,代碼來源:DefaultMavenPluginManager.java

示例11: getPluginDescriptorForPrefix

import org.apache.maven.plugin.descriptor.PluginDescriptor; //導入依賴的package包/類
public PluginDescriptor getPluginDescriptorForPrefix( String prefix )
{
    MavenSession session = legacySupport.getSession();

    PluginPrefixRequest request = new DefaultPluginPrefixRequest( prefix, session );

    try
    {
        PluginPrefixResult result = pluginPrefixResolver.resolve( request );

        Plugin plugin = new Plugin();
        plugin.setGroupId( result.getGroupId() );
        plugin.setArtifactId( result.getArtifactId() );

        return loadPluginDescriptor( plugin, session.getCurrentProject(), session );
    }
    catch ( Exception e )
    {
        return null;
    }
}
 
開發者ID:gems-uff,項目名稱:oceano,代碼行數:22,代碼來源:DefaultPluginManager.java

示例12: loadPluginFully

import org.apache.maven.plugin.descriptor.PluginDescriptor; //導入依賴的package包/類
public PluginDescriptor loadPluginFully( Plugin plugin, MavenProject project, MavenSession session )
    throws ArtifactResolutionException, PluginVersionResolutionException, ArtifactNotFoundException,
    InvalidVersionSpecificationException, InvalidPluginException, PluginManagerException, PluginNotFoundException,
    PluginVersionNotFoundException
{
    PluginDescriptor pluginDescriptor = loadPluginDescriptor( plugin, project, session );

    try
    {
        pluginManager.setupPluginRealm( pluginDescriptor, session, null, null, null );
    }
    catch ( PluginResolutionException e )
    {
        throw new PluginManagerException( plugin, e.getMessage(), e );
    }

    return pluginDescriptor;
}
 
開發者ID:gems-uff,項目名稱:oceano,代碼行數:19,代碼來源:DefaultPluginManager.java

示例13: getPluginContext

import org.apache.maven.plugin.descriptor.PluginDescriptor; //導入依賴的package包/類
public Map getPluginContext( PluginDescriptor plugin, MavenProject project )
{
    Map pluginContextsByKey = (Map) pluginContextsByProjectAndPluginKey.get( project.getId() );

    if ( pluginContextsByKey == null )
    {
        pluginContextsByKey = new HashMap();
        pluginContextsByProjectAndPluginKey.put( project.getId(), pluginContextsByKey );
    }

    Map pluginContext = (Map) pluginContextsByKey.get( plugin.getPluginLookupKey() );

    if ( pluginContext == null )
    {
        pluginContext = new HashMap();
        pluginContextsByKey.put( plugin.getPluginLookupKey(), pluginContext );
    }

    return pluginContext;
}
 
開發者ID:gems-uff,項目名稱:oceano,代碼行數:21,代碼來源:ReactorManager.java

示例14: getPluginContext

import org.apache.maven.plugin.descriptor.PluginDescriptor; //導入依賴的package包/類
public Map<String, Object> getPluginContext( PluginDescriptor plugin, MavenProject project )
{
    String projectKey = project.getId();

    Map<String, Map<String, Object>> pluginContextsByKey = pluginContextsByProjectAndPluginKey.get( projectKey );

    if ( pluginContextsByKey == null )
    {
        pluginContextsByKey = new ConcurrentHashMap<String, Map<String, Object>>();

        pluginContextsByProjectAndPluginKey.put( projectKey, pluginContextsByKey );
    }

    String pluginKey = plugin.getPluginLookupKey();

    Map<String, Object> pluginContext = pluginContextsByKey.get( pluginKey );

    if ( pluginContext == null )
    {
        pluginContext = new ConcurrentHashMap<String, Object>();

        pluginContextsByKey.put( pluginKey, pluginContext );
    }

    return pluginContext;
}
 
開發者ID:gems-uff,項目名稱:oceano,代碼行數:27,代碼來源:MavenSession.java

示例15: retrieveContext

import org.apache.maven.plugin.descriptor.PluginDescriptor; //導入依賴的package包/類
Map<String, Object> retrieveContext( MavenSession session )
{
    Map<String, Object> context = null;

    if ( session != null )
    {
        PluginDescriptor desc = new PluginDescriptor();
        desc.setGroupId( PluginDescriptor.getDefaultPluginGroupId() );
        desc.setArtifactId( PluginDescriptor.getDefaultPluginArtifactId( "toolchains" ) );

        MavenProject current = session.getCurrentProject();
        
        if ( current != null )
        {
            //TODO: why is this using the context
            context = session.getPluginContext( desc, current );
        }
    }

    return ( context != null ) ? context : new HashMap<String, Object>();
}
 
開發者ID:gems-uff,項目名稱:oceano,代碼行數:22,代碼來源:DefaultToolchainManager.java


注:本文中的org.apache.maven.plugin.descriptor.PluginDescriptor類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。