forked from danielflower/maven-gitlog-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed groupid and added new show goal
- Loading branch information
1 parent
0a34703
commit 49d9531
Showing
3 changed files
with
48 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/main/java/com/github/danielflower/mavenplugins/gitlog/ShowMojo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.github.danielflower.mavenplugins.gitlog; | ||
|
||
import org.apache.maven.plugin.AbstractMojo; | ||
import org.apache.maven.plugin.MojoExecutionException; | ||
import org.apache.maven.plugin.MojoFailureException; | ||
|
||
import java.io.IOException; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
/** | ||
* Displays the git log in the maven build log. Use the generate goal to generate reports. | ||
* | ||
* @goal show | ||
*/ | ||
public class ShowMojo extends AbstractMojo { | ||
|
||
public void execute() throws MojoExecutionException, MojoFailureException { | ||
|
||
List<ChangeLogRenderer> renderers = Arrays.<ChangeLogRenderer>asList(new MavenLoggerRenderer(getLog())); | ||
Generator generator = new Generator(renderers, Defaults.COMMIT_FILTERS, getLog()); | ||
|
||
try { | ||
generator.openRepository(); | ||
} catch (IOException e) { | ||
throw new MojoExecutionException("Error opening git repository. Is this Maven project hosted in a git repository? " + | ||
"No changelog will be generated.", e); | ||
} catch (NoGitRepositoryException e) { | ||
throw new MojoExecutionException("This maven project does not appear to be in a git repository, " + | ||
"therefore no git changelog will be generated."); | ||
} | ||
|
||
try { | ||
generator.generate("Git log"); | ||
} catch (IOException e) { | ||
throw new MojoExecutionException("Error while generating changelog. Some changelogs may be incomplete or corrupt.", e); | ||
} | ||
} | ||
|
||
|
||
} |