Git-commit-id-maven-plugin: Using GIT properties to generate other properties

Created on 25 Nov 2014  路  6Comments  路  Source: git-commit-id/git-commit-id-maven-plugin

I'm unable to use the GIT properties like ${git.commit.id.abbrev} to create other properties like this:

    <properties>
        <test>${git.commit.id.abbrev}</test>
    </properties>

IntelliJ also fails to recognize the GIT properties.

Am i missing something here or is this just not possible ?

Most helpful comment

hi @TheSnoozer,

Thank your for posting the example configuration, I've got it working now.

The properties are still marked as invalid by intelliJ (13) though.

Anything we can do about that ?

All 6 comments

Hi @wouter-crowdpark ,
can you paste your plugin configuration?
For example the configuration below should work perfectly:

<plugin>
                <groupId>pl.project13.maven</groupId>
                <artifactId>git-commit-id-plugin</artifactId>
                <version>2.1.10</version>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>revision</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
                    <prefix>git</prefix>
                    <dateFormat>dd.MM.yyyy</dateFormat>
                    <verbose>false</verbose>
                    <skipPoms>true</skipPoms>
                    <abbrevLength>8</abbrevLength>
                    <useNativeGit>true</useNativeGit>
                    <generateGitPropertiesFile>true</generateGitPropertiesFile>
                    <generateGitPropertiesFilename>target/classes/revision.properties</generateGitPropertiesFilename>
                    <failOnNoGitDirectory>false</failOnNoGitDirectory>
                    <failOnUnableToExtractRepoInfo>true</failOnUnableToExtractRepoInfo>
                    <gitDescribe>
                        <skip>false</skip>
                        <always>true</always>
                        <abbrev>8</abbrev>
                        <tags>true</tags>
                        <dirty>-dirty</dirty>
                        <forceLongFormat>false</forceLongFormat>
                    </gitDescribe>
                </configuration>
            </plugin>

hi @TheSnoozer,

Thank your for posting the example configuration, I've got it working now.

The properties are still marked as invalid by intelliJ (13) though.

Anything we can do about that ?

Hi @wouter-crowdpark ,
well I'm ot sure about intelliJ. I'm currently using STS with eclipse.
intelliJ might thing that the properties are invalid because they will be generated at runtime, with a configurable prefix in the pom:

<prefix>$PREFIX</prefix>

will result in properties like

$PREFIX.commit.id
$PREFIX.commit.id.abbrev

so it migth be a false-positive in intelliJ or some configuration option....

Hi @wouter-crowdpark ,
do you have any updates, questions, comments or concerns on this?

otherwise I would like to close the issue.

Thanks,

@wouter-crowdpark , I'm also looking for a method to disable Intellij's Can not resolve symbol 'git.commit.id' warning. Any ideas?

You could use a workaround as described here: https://stackoverflow.com/a/37491140/1183192

Was this page helpful?
0 / 5 - 0 ratings