简体   繁体   中英

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:

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 eg 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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM