Skip to content

Commit

Permalink
Fixed groupid and added new show goal
Browse files Browse the repository at this point in the history
  • Loading branch information
danielflower committed Sep 18, 2011
1 parent 0a34703 commit 49d9531
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 2 deletions.
5 changes: 5 additions & 0 deletions maven-gitlog-plugin.iml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
<sourceFolder url="file://$MODULE_DIR$/target/generated-sources/plugin" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/target/generated-sources/test-annotations" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/target/generated-sources/annotations" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/target/classes" />
<excludeFolder url="file://$MODULE_DIR$/target/maven-archiver" />
<excludeFolder url="file://$MODULE_DIR$/target/surefire" />
<excludeFolder url="file://$MODULE_DIR$/target/surefire-reports" />
<excludeFolder url="file://$MODULE_DIR$/target/test-classes" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.apache.maven.plugins</groupId>
<groupId>com.github.danielflower.mavenplugins</groupId>
<artifactId>maven-gitlog-plugin</artifactId>
<version>1.4.4-SNAPSHOT</version>
<version>1.4.5-SNAPSHOT</version>

<packaging>maven-plugin</packaging>
<name>Maven Git Log Plugin</name>
Expand Down
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);
}
}


}

0 comments on commit 49d9531

Please sign in to comment.