Example usage for org.apache.maven.plugin.descriptor PluginDescriptor getPlugin

List of usage examples for org.apache.maven.plugin.descriptor PluginDescriptor getPlugin

Introduction

In this page you can find the example usage for org.apache.maven.plugin.descriptor PluginDescriptor getPlugin.

Prototype

public Plugin getPlugin() 

Source Link

Usage

From source file:com.ariatemplates.attester.maven.ArtifactExtractor.java

License:Apache License

public void execute() throws MojoExecutionException, MojoFailureException {
    try {/*from   w  w  w.j a va  2 s  .  c  om*/
        Map<?, ?> context = getPluginContext();
        PluginDescriptor pluginDescriptor = (PluginDescriptor) context.get("pluginDescriptor");
        Model projectModel = project.getModel();
        for (Dependency dependency : pluginDescriptor.getPlugin().getDependencies()) {
            if ("zip".equalsIgnoreCase(dependency.getType())) {
                String outputDirectory = inplaceExtractDependency(session.getLocalRepository(), dependency);
                projectModel.addProperty(getPropertyName(dependency), outputDirectory);
            }
        }
    } catch (Exception e) {
        throw new MojoExecutionException("Error", e);
    }
}