All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.buschmais.jqassistant.scm.maven.ListPluginsMojo Maven / Gradle / Ivy

Go to download

jQAssistant plugin for Apache Maven to integrate jQAssistant into a Maven based project.

There is a newer version: 2.5.0
Show newest version
package com.buschmais.jqassistant.scm.maven;

import java.util.List;
import java.util.stream.Collectors;

import com.buschmais.jqassistant.core.runtime.api.plugin.PluginInfo;

import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Mojo;

/**
 * Lists all plugins known based on the current configuration
 * to jQAssistant.
 */
@Mojo(name = "list-plugins", threadSafe = true)
public class ListPluginsMojo extends AbstractProjectMojo {

    @Override
    protected void aggregate(MojoExecutionContext mojoExecutionContext) throws MojoExecutionException {
        getLog().info("Available plugins for '" + mojoExecutionContext.getRootModule()
            .getName() + "'.");

        List sortedInfos = mojoExecutionContext.getPluginRepository()
            .getPluginOverview()
            .stream()
            .sorted(PluginInfo.NAME_COMPARATOR)
            .collect(Collectors.toList());

        sortedInfos.forEach(info -> {
            CharSequence name = info.getName();
            CharSequence id = info.getId();
            String output = String.format("%s (%s)", name, id);
            System.out.println(output);
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy