Class ContributorsMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- com.github.koraktor.mavanagaiata.mojo.AbstractGitMojo
-
- com.github.koraktor.mavanagaiata.mojo.AbstractGitOutputMojo
-
- com.github.koraktor.mavanagaiata.mojo.ContributorsMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
@Mojo(name="contributors", defaultPhase=PROCESS_RESOURCES, threadSafe=true) public class ContributorsMojo extends AbstractGitOutputMojoThis goal allows to generate a list of contributors for the currently checked out branch of the Git repository. It will list all authors of the commits in this branch. It can be configured to display the changelog or save it to a file.- Since:
- 0.2.0
- Author:
- Sebastian Staudt
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classContributorsMojo.Contributor(package private) classContributorsMojo.ContributorsWalkAction
-
Field Summary
Fields Modifier and Type Field Description (package private) StringcontributorPrefixThe string to prepend to every contributor name(package private) booleanescapeHtml(package private) booleanescapeMarkdown(package private) StringheaderThe header to print above the changelogprivate MailMapmailMapprivate static Map<CharSequence,CharSequence>MARKDOWN_TRANSLATION_MAPprivate static org.apache.commons.text.translate.CharSequenceTranslatorMARKDOWN_TRANSLATOR(package private) FileoutputFileThe file to write the contributors list to(package private) booleanshowCountsWhether the number of contributions should be listed(package private) booleanshowEmailWhether the email addresses of contributors should be listed(package private) StringsortThe method used to sort contributors-
Fields inherited from class com.github.koraktor.mavanagaiata.mojo.AbstractGitOutputMojo
encoding, footer, printStream
-
Fields inherited from class com.github.koraktor.mavanagaiata.mojo.AbstractGitMojo
baseDir, dateFormat, dirtyFlag, dirtyIgnoreUntracked, failGracefully, gitDir, head, project, propertyPrefixes, skip, skipNoGit
-
-
Constructor Summary
Constructors Constructor Description ContributorsMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private StringescapeName(String name)Returns an escaped form of the contributor nameFilegetOutputFile()Returns the output file for the generated contributors listprotected voidinitConfiguration()Selects the attribute to use for sorting contributorsvoidsetOutputFile(File outputFile)Sets the output file for the generated contributors listprotected voidwriteOutput(GitRepository repository)Walks through the history of the currently checked out branch of the Git repository and builds a list of contributors from the authors of the commits.-
Methods inherited from class com.github.koraktor.mavanagaiata.mojo.AbstractGitOutputMojo
createPrintStream, generateOutput, init, run, unescapeFormatNewlines
-
Methods inherited from class com.github.koraktor.mavanagaiata.mojo.AbstractGitMojo
addProperty, execute, initRepository, prepareParameters
-
-
-
-
Field Detail
-
MARKDOWN_TRANSLATION_MAP
private static final Map<CharSequence,CharSequence> MARKDOWN_TRANSLATION_MAP
-
MARKDOWN_TRANSLATOR
private static final org.apache.commons.text.translate.CharSequenceTranslator MARKDOWN_TRANSLATOR
-
contributorPrefix
@Parameter(property="mavanagaiata.contributors.contributorPrefix", defaultValue=" * ") String contributorPrefixThe string to prepend to every contributor name
-
escapeHtml
@Parameter(property="mavanagaiata.contributors.escapeHtml", defaultValue="false") boolean escapeHtml
-
escapeMarkdown
@Parameter(property="mavanagaiata.contributors.escapeMarkdown", defaultValue="false") boolean escapeMarkdown
-
header
@Parameter(property="mavanagaiata.contributors.header", defaultValue="Contributors\n============\n") String headerThe header to print above the changelog
-
mailMap
private MailMap mailMap
-
outputFile
@Parameter(property="mavanagaiata.contributors.outputFile") File outputFile
The file to write the contributors list to
-
showCounts
@Parameter(property="mavanagaiata.contributors.showCounts", defaultValue="true") boolean showCountsWhether the number of contributions should be listed
-
showEmail
@Parameter(property="mavanagaiata.contributors.showEmail", defaultValue="false") boolean showEmailWhether the email addresses of contributors should be listed
-
sort
@Parameter(property="mavanagaiata.contributors.sort", defaultValue="count") String sortThe method used to sort contributorsAvailable values are
count,dateandname.
-
-
Method Detail
-
initConfiguration
protected void initConfiguration()
Selects the attribute to use for sorting contributors- Overrides:
initConfigurationin classAbstractGitOutputMojo
-
writeOutput
protected void writeOutput(GitRepository repository) throws MavanagaiataMojoException
Walks through the history of the currently checked out branch of the Git repository and builds a list of contributors from the authors of the commits.- Specified by:
writeOutputin classAbstractGitOutputMojo- Parameters:
repository- The repository the mojo is running in- Throws:
MavanagaiataMojoException- if retrieving information from the Git repository fails
-
escapeName
private String escapeName(String name)
Returns an escaped form of the contributor nameDepending on the
escapeHtmlandescapeMarkdownfields this methods escapes HTML tags and/or Markdown link brackets.- Parameters:
name- The name of the contributor- Returns:
- An escaped form of the contributor
-
getOutputFile
public File getOutputFile()
Returns the output file for the generated contributors list- Specified by:
getOutputFilein classAbstractGitOutputMojo- Returns:
- The output file for the generated contributors list
-
setOutputFile
public void setOutputFile(File outputFile)
Sets the output file for the generated contributors list- Specified by:
setOutputFilein classAbstractGitOutputMojo- Parameters:
outputFile- The output file for the generated contributors list
-
-