Skip to content

Commit ed405f4

Browse files
committed
Template can be configured directly in the pom #2
1 parent 60c9851 commit ed405f4

File tree

5 files changed

+76
-6
lines changed

5 files changed

+76
-6
lines changed

CHANGELOG.md

+16-1
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,24 @@
33
Changelog of Git Changelog Maven plugin.
44

55
## Next release
6+
### GitHub [#2](https://github.com/tomasbjerre/git-changelog-maven-plugin/issues/2) Allow for template to be added directly in pom.xml
7+
8+
[f2260d8c648971f](https://github.com/tomasbjerre/git-changelog-maven-plugin/commit/f2260d8c648971f) Tomas Bjerre *2015-12-20 17:29:08*
9+
10+
Template can be configured directly in the pom
11+
12+
13+
### Other changes
14+
15+
[60c9851e33217e2](https://github.com/tomasbjerre/git-changelog-maven-plugin/commit/60c9851e33217e2) Tomas Bjerre *2015-12-10 17:11:56*
16+
17+
Using lib 1.18
18+
19+
20+
## git-changelog-maven-plugin-1.9
621
### GitHub [#1](https://github.com/tomasbjerre/git-changelog-maven-plugin/issues/1) Update to lates lib version
722

8-
[c2fbe45b2a1393d](https://github.com/tomasbjerre/git-changelog-maven-plugin/commit/c2fbe45b2a1393d) Tomas Bjerre *2015-12-06 07:36:39*
23+
[012e716f4ac9081](https://github.com/tomasbjerre/git-changelog-maven-plugin/commit/012e716f4ac9081) Tomas Bjerre *2015-12-06 07:37:23*
924

1025
Using lib 1.17
1126

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Here is and example that will generate a CHANGELOG.md. There is also a running e
1212
<plugin>
1313
<groupId>se.bjurr.gitchangelog</groupId>
1414
<artifactId>git-changelog-maven-plugin</artifactId>
15-
<version>1.9</version>
15+
<version>1.10</version>
1616
<executions>
1717
<execution>
1818
<id>GenerateGitChangelog</id>

git-changelog-maven-plugin-example/CHANGELOG.md

+16-1
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,24 @@
33
Changelog of Git Changelog Maven plugin.
44

55
## Next release
6+
### GitHub [#2](https://github.com/tomasbjerre/git-changelog-maven-plugin/issues/2) Allow for template to be added directly in pom.xml
7+
8+
[f2260d8c648971f](https://github.com/tomasbjerre/git-changelog-maven-plugin/commit/f2260d8c648971f) Tomas Bjerre *2015-12-20 17:29:08*
9+
10+
Template can be configured directly in the pom
11+
12+
13+
### Other changes
14+
15+
[60c9851e33217e2](https://github.com/tomasbjerre/git-changelog-maven-plugin/commit/60c9851e33217e2) Tomas Bjerre *2015-12-10 17:11:56*
16+
17+
Using lib 1.18
18+
19+
20+
## git-changelog-maven-plugin-1.9
621
### GitHub [#1](https://github.com/tomasbjerre/git-changelog-maven-plugin/issues/1) Update to lates lib version
722

8-
[c2fbe45b2a1393d](https://github.com/tomasbjerre/git-changelog-maven-plugin/commit/c2fbe45b2a1393d) Tomas Bjerre *2015-12-06 07:36:39*
23+
[012e716f4ac9081](https://github.com/tomasbjerre/git-changelog-maven-plugin/commit/012e716f4ac9081) Tomas Bjerre *2015-12-06 07:37:23*
924

1025
Using lib 1.17
1126

git-changelog-maven-plugin-example/pom.xml

+33-2
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,40 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
2626
</goals>
2727
<configuration>
2828
<toRef>refs/heads/master</toRef>
29-
<templateFile>changelog.mustache</templateFile>
3029
<settingsFile>changelog.json</settingsFile>
31-
30+
31+
<!-- Template from file //-->
32+
<!-- templateFile>changelog.mustache</templateFile //-->
33+
34+
<!-- Template here //-->
35+
<!-- templateContent>
36+
<![CDATA[
37+
# Git Changelog Maven plugin changelog
38+
39+
Changelog of Git Changelog Maven plugin.
40+
41+
{{#tags}}
42+
## {{name}}
43+
{{#issues}}
44+
{{#hasLink}}
45+
### {{name}} [{{issue}}]({{link}}) {{title}}
46+
{{/hasLink}}
47+
{{^hasLink}}
48+
### {{name}}
49+
{{/hasLink}}
50+
51+
{{#commits}}
52+
[{{hash}}](https://github.com/tomasbjerre/git-changelog-maven-plugin/commit/{{hash}}) {{authorName}} *{{commitTime}}*
53+
54+
{{{message}}}
55+
56+
{{/commits}}
57+
58+
{{/issues}}
59+
{{/tags}}
60+
]]>
61+
</templateContent//-->
62+
3263
<!-- A file on filesystem //-->
3364
<filePath>CHANGELOG.md</filePath>
3465

src/main/java/se/bjurr/gitchangelog/plugin/GitChangelogMojo.java

+10-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ public class GitChangelogMojo extends AbstractMojo {
3030
private String settingsFile;
3131
@Parameter(property = "templateFile", required = false)
3232
private String templateFile;
33+
@Parameter(property = "templateContent", required = false)
34+
private String templateContent;
3335
@Parameter(property = "filePath", required = false)
3436
private String filePath;
3537

@@ -48,9 +50,16 @@ public void execute() throws MojoExecutionException {
4850
GitChangelogApi builder;
4951
builder = gitChangelogApiBuilder() //
5052
.withSettings(new File(settingsFile).toURI().toURL()) //
51-
.withTemplatePath(templateFile) //
5253
.withToRef(toRef);
5354

55+
if (!isNullOrEmpty(templateFile)) {
56+
builder //
57+
.withTemplatePath(templateFile);
58+
}
59+
if (!isNullOrEmpty(templateContent)) {
60+
builder //
61+
.withTemplateContent(templateContent);
62+
}
5463
if (!isNullOrEmpty(fromCommit)) {
5564
builder //
5665
.withFromCommit(fromCommit);

0 commit comments

Comments
 (0)