How can I in a jsp page get maven project version number?

后端 未结 11 2243
天命终不由人
天命终不由人 2020-12-14 16:07

I am working on a java web application, managed by maven2. From time to time, we did some changes, and want to do new releases, of course with new version number. In the hom

11条回答
  •  一个人的身影
    2020-12-14 16:47

    Use the maven-replacer-plugin

    Include the plugin in your pom.xml like this:

        
            com.google.code.maven-replacer-plugin
            replacer
            (version)
            
                
                    prepare-package
                    
                        replace
                                        
                
            
            
                true
                target/someapp/jsp/helloWorld.jsp
                
                    target/someapp/jsp/helloWorld-updated.jsp
                
                false
                $BUILD_NUMBER$
                ${buildNumber}
            
        
    

    Now anywhere in the specified file that has the token$BUILD_NUMBER$ the token will get replaced.

提交回复
热议问题