Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generating git.properties file with git information

Tags:

git

maven

I am trying to generate git.properties file in my project. I have added the git-commit-plugin dependency in pom.xml. Please find my code below

            <plugin>
                <groupId>pl.project13.maven</groupId>
                <artifactId>git-commit-id-plugin</artifactId>
                <version>2.1.4</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>revision</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <verbose>true</verbose>
                    <dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
                    <dateFormat>MM-dd-yyyy '@' HH:mm:ss Z</dateFormat>
                    <generateGitPropertiesFile>true</generateGitPropertiesFile>               <generateGitPropertiesFilename>src/main/resources/git.properties</generateGitPropertiesFilename>
                    <failOnNoGitDirectory>true</failOnNoGitDirectory>
                </configuration>
            </plugin>

Also added git.properties in gitignore file. But i cant generate the properties in my project.

like image 552
Rakesh Gourineni Avatar asked Jan 13 '14 23:01

Rakesh Gourineni


1 Answers

I found the answer to my question. The above pom.xml has Plugins for git.properties in . In the same pom.xml I missed to add the included

    <includes>
    <include>**/*.properties</include>
    </includes>

Also in add the following(besides to PluginManagement)

        <plugin>
            <groupId>pl.project13.maven</groupId>
            <artifactId>git-commit-id-plugin</artifactId>
        </plugin>

Hope this solves your problem to generate git.properties file

like image 108
Rakesh Gourineni Avatar answered Oct 15 '22 19:10

Rakesh Gourineni