Tristate
Tristate

Reputation: 1821

buildnumber maven plugin return buildnumber null

Pls help me guys what i do wrong

<scm>
    <connection>            scm:git:https://github.com/MyName/MyProject.git</connection>
    <url>                   scm:git:https://github.com/MyName/MyProject.git</url>
    <developerConnection>   scm:git:https://github.com/MyName/MyProject.git</developerConnection>
</scm>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.build.timestamp.format>yyyy-MM-dd-HH-mm</maven.build.timestamp.format>
    <build.timestamp>${maven.build.timestamp}</build.timestamp>

</properties>

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>buildnumber-maven-plugin</artifactId>
            <version>1.3</version>
            <executions>
                <execution>
                    <phase>validate</phase>
                    <goals>
                        <goal>create</goal>
                    </goals>
                </execution>
            </executions>

        </plugin>

This result always in [INFO] Storing buildNumber: null at timestamp: 1420565104807 [WARNING] Cannot get the branch information from the git repository: Detecting the current branch failed:

Upvotes: 0

Views: 2417

Answers (1)

Dean McNabb
Dean McNabb

Reputation: 39

It is possible that you don't have git on the Path (System environment variable), so maven cannot use it to retrieve the build number from your repository. Or you need to explicitly tell the plugin what provider implementation you are using e.g. git

You may also need to add a dependency to include git if you cannot add it to your Path.

I also had this issue with svn, although mine was probably related to the version of TortoiseSVN I have versus the version in the local repository (TortoiseSVN was old whereas my eclipse plugin was the latest). So I updated the build plugin to:

<plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>buildnumber-maven-plugin</artifactId>
            <version>1.3</version>
            <executions>
                <execution>
                    <phase>validate</phase>
                    <goals>
                        <goal>create</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <doCheck>false</doCheck>
                <doUpdate>false</doUpdate>
                <revisionOnScmFailure>unavailable</revisionOnScmFailure>
                <providerImplementations>
                    <svn>javasvn</svn>
                </providerImplementations>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>org.tmatesoft.svnkit</groupId>
                    <artifactId>svnkit</artifactId>
                    <version>1.8.9</version>
                </dependency>
            </dependencies>
        </plugin>

Upvotes: 1

Related Questions