tomasbjerre / git-changelog-maven-plugin

Maven plugin that can generate a changelog, or releasenotes, from git repository
Other
80 stars 36 forks source link

Is it possible to pass property from pom.xml to template file? #38

Closed arboeh closed 2 years ago

arboeh commented 2 years ago

Is it possible to pass a property from pom.xml to the *.mustache-file? I would like to extend the template with some values.

tomasbjerre commented 2 years ago

I think it works if you have the template within the pom. Does that solve your problem? If you put the template within <templateContent>: https://github.com/tomasbjerre/git-changelog-maven-plugin/blob/eb57be4b2933839c834052e5c307956832389d26/git-changelog-maven-plugin-example/pom.xml#L89

arboeh commented 2 years ago

Not really. I want to keep my pom as slim as possible, that's why I asked. How would it be possible to add a property inside the template content part of the plugin? I would give it a try. Btw: Thanks for your quick reply! 👍

tomasbjerre commented 2 years ago

If you try to use <templateContent> I think you can just put ${whatever.property.name} within the template. Bu I'm not sure.

You may also have a look at the extendedVariables attribute that you can set in the pom and use in the template. The key wold be the name to use in the template, and value you can set to ${whatever.property.you.want}: https://github.com/tomasbjerre/git-changelog-maven-plugin/blob/eb57be4b2933839c834052e5c307956832389d26/src/main/java/se/bjurr/gitchangelog/plugin/GitChangelogMojo.java#L40

arboeh commented 2 years ago

I will try it tomorrow. Thanks!

arboeh commented 2 years ago

It's working. Thanks!