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

com.kribblo.github.mojo.ProjectInfoJsonMojo Maven / Gradle / Ivy

Go to download

Light-weight project information extractor, for reporting optionally filtered dependencies and some other things on a project. Useful for collecting version information and who depends on who in an environment with multiple servers, perhaps many many small services.

The newest version!
package com.kribblo.github.mojo;

import org.apache.maven.plugin.*;
import org.apache.maven.plugin.logging.Log;
import org.apache.maven.plugins.annotations.*;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.project.MavenProject;

import java.io.File;

@Mojo(name = "project-info", defaultPhase = LifecyclePhase.GENERATE_RESOURCES)
public class ProjectInfoJsonMojo extends AbstractMojo {

	@Parameter(defaultValue = "${project}", readonly = true)
	private MavenProject mavenProject;

	@Parameter(defaultValue = "${project.build.directory/project-info.json}")
	private File outputFile;

	@Parameter(required = false)
	private String groupIdFilter;

	@Override
	public void execute() throws MojoExecutionException, MojoFailureException {
		ProjectInfoFactory factory = new ProjectInfoFactory(mavenProject);
		ProjectInfo projectInfo = factory.getProjectInfo(groupIdFilter);

		ProjectInfoJsonWriter jsonWriter = new ProjectInfoJsonWriter(outputFile);
		jsonWriter.writeJsonToFile(projectInfo);

		Log log = getLog();
		log.info("Wrote JSON info for " + projectInfo + " to " + outputFile);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy