maven-buildnumber-plugin svn revision available only when not using format

前端 未结 4 1444
后悔当初
后悔当初 2021-01-02 08:31

While using the maven-buildnumber-plugin 1.0 beta 4, it seems that I can get the svn revision unless I use a tag within the configuration. Once

4条回答
  •  佛祖请我去吃肉
    2021-01-02 08:48

    The buildnumber-maven-plugin is pretty darn quirky, which is probably why it's still a beta. The format is only for those items you wish to apply a Java message format to and in most cases, it only useful with timestamps and literal strings. If you don't need a timestamp don't use the format option when getting the Subversion revision number. If you use the format, then like you indicated, it'll give you a build number that always increments by one rather than the SCM version number.

    If you do need the timestamp or have other items your deriving from the buildnumber plugin as well as the Subversion revision, do each one as a separate executions. Here's an example of how to get the Subverison revision number and the build timestamp using two separate executions of the plugin:

    
        org.codehaus.mojo
        buildnumber-maven-plugin
        1.0-beta-4
        
            
                generate-buildnumber
                    validate
                
                    create
                
                
                    true
                    buildRevision
                
            
            
                generate-timestamp
                validate
                
                    create
                
                
                    {0,date,yyyy-MM-dd HH:mm:ss}
                    
                        timestamp
                    
                    buildDateTime
                
            
        
    
    

    The key to making this work is using the buildNumberPropertyName element. Checkout the plugin's Usage page for more information about the usefulness of the Java message format is for.

提交回复
热议问题