Search in sources :

Example 1 with PluginDescriptor

use of org.apache.maven.plugin.descriptor.PluginDescriptor in project intellij-community by JetBrains.

the class CustomPluginDescriptorCache method patchedClone.

private static PluginDescriptor patchedClone(PluginDescriptor pluginDescriptor) {
    if (pluginDescriptor == null)
        return null;
    PluginDescriptor clone = clone(pluginDescriptor);
    clone.setDependencies(new ArrayList<ComponentDependency>(pluginDescriptor.getDependencies()));
    return clone;
}
Also used : PluginDescriptor(org.apache.maven.plugin.descriptor.PluginDescriptor) ComponentDependency(org.codehaus.plexus.component.repository.ComponentDependency)

Example 2 with PluginDescriptor

use of org.apache.maven.plugin.descriptor.PluginDescriptor in project maven-plugins by apache.

the class AggregatorJavadocReportTest method lookupMojo.

private JavadocReport lookupMojo(File testPom) throws Exception {
    JavadocReport mojo = (JavadocReport) lookupMojo("aggregate", testPom);
    PluginDescriptor pluginDescriptor = new PluginDescriptor();
    pluginDescriptor.setPlugin(new Plugin());
    setVariableValueToObject(mojo, "plugin", pluginDescriptor);
    return mojo;
}
Also used : PluginDescriptor(org.apache.maven.plugin.descriptor.PluginDescriptor) Plugin(org.apache.maven.model.Plugin)

Example 3 with PluginDescriptor

use of org.apache.maven.plugin.descriptor.PluginDescriptor in project maven-plugins by apache.

the class JavadocJarTest method lookupMojo.

private JavadocJar lookupMojo(File testPom) throws Exception {
    JavadocJar mojo = (JavadocJar) lookupMojo("jar", testPom);
    PluginDescriptor pluginDescriptor = new PluginDescriptor();
    pluginDescriptor.setPlugin(new Plugin());
    setVariableValueToObject(mojo, "plugin", pluginDescriptor);
    return mojo;
}
Also used : PluginDescriptor(org.apache.maven.plugin.descriptor.PluginDescriptor) Plugin(org.apache.maven.model.Plugin)

Example 4 with PluginDescriptor

use of org.apache.maven.plugin.descriptor.PluginDescriptor in project camel by apache.

the class RunMojo method determineRelevantPluginDependencies.

/**
     * Determine all plugin dependencies relevant to the executable. Takes
     * includePlugins, and the executableDependency into consideration.
     *
     * @return a set of Artifact objects. (Empty set is returned if there are no
     *         relevant plugin dependencies.)
     * @throws MojoExecutionException
     */
private Set<Artifact> determineRelevantPluginDependencies() throws MojoExecutionException {
    Set<Artifact> relevantDependencies;
    if (this.includePluginDependencies) {
        if (this.executableDependency == null) {
            getLog().debug("All Plugin Dependencies will be included.");
            relevantDependencies = new HashSet<Artifact>(this.pluginDependencies);
        } else {
            getLog().debug("Selected plugin Dependencies will be included.");
            Artifact executableArtifact = this.findExecutableArtifact();
            Artifact executablePomArtifact = this.getExecutablePomArtifact(executableArtifact);
            relevantDependencies = this.resolveExecutableDependencies(executablePomArtifact, false);
        }
    } else {
        getLog().debug("Only Direct Plugin Dependencies will be included.");
        PluginDescriptor descriptor = (PluginDescriptor) getPluginContext().get("pluginDescriptor");
        try {
            relevantDependencies = artifactResolver.resolveTransitively(MavenMetadataSource.createArtifacts(this.artifactFactory, descriptor.getPlugin().getDependencies(), null, null, null), this.project.getArtifact(), Collections.emptyMap(), this.localRepository, this.remoteRepositories, metadataSource, new ScopeArtifactFilter(Artifact.SCOPE_RUNTIME), Collections.emptyList()).getArtifacts();
        } catch (Exception ex) {
            throw new MojoExecutionException("Encountered problems resolving dependencies of the plugin " + "in preparation for its execution.", ex);
        }
    }
    return relevantDependencies;
}
Also used : PluginDescriptor(org.apache.maven.plugin.descriptor.PluginDescriptor) ScopeArtifactFilter(org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) Artifact(org.apache.maven.artifact.Artifact) InvalidVersionSpecificationException(org.apache.maven.artifact.versioning.InvalidVersionSpecificationException) MalformedURLException(java.net.MalformedURLException) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) MojoFailureException(org.apache.maven.plugin.MojoFailureException)

Example 5 with PluginDescriptor

use of org.apache.maven.plugin.descriptor.PluginDescriptor in project sofa-ark by alipay.

the class RepackageMojo method execute.

@Override
public void execute() throws MojoExecutionException, MojoFailureException {
    if (this.project.getPackaging().equals("war")) {
        getLog().debug("repackage goal could not be applied to war project.");
        return;
    }
    if (this.project.getPackaging().equals("pom")) {
        getLog().debug("repackage goal could not be applied to pom project.");
        return;
    }
    if (StringUtils.isSameStr(this.arkClassifier, this.bizClassifier)) {
        getLog().debug("Executable fat jar should be different from 'plug-in' module jar.");
        return;
    }
    if (this.skip) {
        getLog().debug("skipping repackaging as configuration.");
        return;
    }
    /* version of SOFA ark container packaged into fat jar follows the plugin version */
    PluginDescriptor pluginDescriptor = (PluginDescriptor) getPluginContext().get("pluginDescriptor");
    arkVersion = pluginDescriptor.getVersion();
    repackage();
}
Also used : PluginDescriptor(org.apache.maven.plugin.descriptor.PluginDescriptor)

Aggregations

PluginDescriptor (org.apache.maven.plugin.descriptor.PluginDescriptor)25 Plugin (org.apache.maven.model.Plugin)12 File (java.io.File)7 MojoDescriptor (org.apache.maven.plugin.descriptor.MojoDescriptor)7 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)6 MojoFailureException (org.apache.maven.plugin.MojoFailureException)6 MavenProject (org.apache.maven.project.MavenProject)5 IOException (java.io.IOException)3 URLClassLoader (java.net.URLClassLoader)3 Artifact (org.apache.maven.artifact.Artifact)3 MavenSession (org.apache.maven.execution.MavenSession)3 MojoDescriptorCreator (org.apache.maven.lifecycle.internal.MojoDescriptorCreator)3 PluginVersionRequest (org.apache.maven.plugin.version.PluginVersionRequest)3 PluginVersionResolver (org.apache.maven.plugin.version.PluginVersionResolver)3 PluginInfo (org.apache.maven.plugins.help.DescribeMojo.PluginInfo)3 MavenPluginManagerHelper (org.apache.maven.reporting.exec.MavenPluginManagerHelper)3 Xpp3Dom (org.codehaus.plexus.util.xml.Xpp3Dom)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 MalformedURLException (java.net.MalformedURLException)2 ArrayList (java.util.ArrayList)2