Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for providing GIT source directory path #64

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 38 additions & 31 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,55 +60,62 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>2.2.1</version>
<version>3.8.5</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.3</version>
</dependency>
<dependency>
<groupId>com.madgag</groupId>
<artifactId>org.eclipse.jgit</artifactId>
<version>2.99.99.2.0-UNOFFICIAL-ROBERTO-RELEASE</version>
<exclusions>
<exclusion>
<artifactId>jsch</artifactId>
<groupId>com.jcraft</groupId>
</exclusion>
</exclusions>
<version>3.6.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.eclipse.jgit/org.eclipse.jgit -->
<dependency>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit</artifactId>
<version>6.1.0.202203080745-r</version>
<exclusions>
<exclusion>
<artifactId>jsch</artifactId>
<groupId>com.jcraft</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<version>2.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.0.1</version>
<version>3.12.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.3</version>
<version>2.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.reporting</groupId>
<artifactId>maven-reporting-api</artifactId>
<version>3.0</version>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-sink-api</artifactId>
<version>1.0</version>
<version>1.11.1</version>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>1.3.04</version>
<version>2.0.2</version>
</dependency>
</dependencies>
<build>
Expand All @@ -131,7 +138,7 @@
</plugin>
<plugin>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.4</version>
<version>3.6.4</version>
<executions>
<execution>
<id>default-descriptor</id>
Expand All @@ -153,15 +160,15 @@
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<version>3.10.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.9</version>
<version>3.3.0</version>
<executions>
<execution>
<id>analyze</id>
Expand All @@ -178,7 +185,7 @@
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.4</version>
<version>3.11.0</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.doxia</groupId>
Expand All @@ -200,11 +207,11 @@
</plugin>
<plugin>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.18.1</version>
<version>2.22.2</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.8</version>
<version>3.1.2</version>
<reportSets>
<reportSet>
<reports>
Expand Down Expand Up @@ -237,7 +244,7 @@
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>2.4</version>
<version>3.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
Expand All @@ -249,7 +256,7 @@
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.1</version>
<version>3.3.2</version>
<executions>
<execution>
<id>attach-javadocs</id>
Expand All @@ -262,7 +269,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<version>3.0.1</version>
<executions>
<execution>
<id>sign-artifacts</id>
Expand All @@ -276,7 +283,7 @@
<plugin>
<groupId>com.github.github</groupId>
<artifactId>site-maven-plugin</artifactId>
<version>0.11</version>
<version>0.12</version>
<executions>
<execution>
<phase>site</phase>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ public class GenerateMojo extends AbstractMojo {
@Parameter(defaultValue = "${project.name} v${project.version} git changelog")
private String reportTitle;

/**
* The GIT directory to scan. Defaults to the project base directory.
*/
@Parameter()
protected File gitDirectory;

/**
* If true, then a plain text changelog will be generated.
Expand Down Expand Up @@ -330,7 +335,8 @@ public void execute() throws MojoExecutionException, MojoFailureException {
Repository repository;

try {
repository = generator.openRepository();
getLog().info("Reading GIT repository at " + (gitDirectory != null ? gitDirectory : System.getProperty("user.dir")));
repository = generator.openRepository(gitDirectory);
} catch (IOException e) {
getLog().warn("Error opening git repository. Is this Maven project hosted in a git repository? " +
"No changelog will be generated.", e);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.github.danielflower.mavenplugins.gitlog;

import org.apache.maven.doxia.sink.Sink;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Mojo;
Expand All @@ -8,7 +9,6 @@
import java.util.Locale;
import org.apache.maven.reporting.MavenReport;
import org.apache.maven.reporting.MavenReportException;
import org.codehaus.doxia.sink.Sink;

/**
* Goal which generates a changelog based on commits made to the current git repo.
Expand All @@ -31,7 +31,7 @@ public void generate(Sink sink, Locale locale)
}
}

@Override
@Override
public String getOutputName()
{
return "gitlog";
Expand Down