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

io.ultreia.java4all.config.plugin.AggregateReportMojo Maven / Gradle / Ivy

There is a newer version: 1.0.29
Show newest version
package io.ultreia.java4all.config.plugin;

/*
 * #%L
 * Config :: Maven plugin
 * %%
 * Copyright (C) 2016 - 2018 Code Lutin, Ultreia.io
 * %%
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as 
 * published by the Free Software Foundation, either version 3 of the 
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Lesser Public License for more details.
 * 
 * You should have received a copy of the GNU General Lesser Public 
 * License along with this program.  If not, see
 * .
 * #L%
 */

import org.apache.maven.artifact.DependencyResolutionRequiredException;
import org.apache.maven.plugins.annotations.Execute;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.annotations.ResolutionScope;
import org.apache.maven.project.MavenProject;
import org.apache.maven.reporting.MavenReportException;
import io.ultreia.java4all.config.ApplicationConfigProvider;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * Generates a report for declared application config via the
 * {@link ApplicationConfigProvider} mechanism on a aggregate mojo.
 * 

* For each configuration, you can find all his options and actions. * * @author Tony - [email protected] * @since 3.0 */ @Mojo(name = "aggregate-report", aggregator = true, requiresReports = true, requiresDependencyResolution = ResolutionScope.RUNTIME) @Execute(phase = LifecyclePhase.COMPILE) public class AggregateReportMojo extends ReportMojoSupport { /** * The projects in the reactor. */ @Parameter(property = "reactorProjects", readonly = true, required = true) private List reactorProjects; @Override protected ClassLoader createClassLoader() throws MavenReportException { Set paths = new HashSet<>(); for (MavenProject p : reactorProjects) { try { List runtimeClasspathElements = p.getRuntimeClasspathElements(); paths.addAll(runtimeClasspathElements); } catch (DependencyResolutionRequiredException e) { throw new MavenReportException("Could not obtain dependencies for project " + p); } } return createClassLoader(paths); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy