maven - read version number from property file

前端 未结 4 371
自闭症患者
自闭症患者 2020-12-19 00:56

I`m trying to read my build version number from a text file, and then assign it to the generated package name: myRelease-1.1.1.apk where the build number is manually set int

4条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-19 01:39

    I found I could work around this problem in maven by using the stuff about reading from the file suggested above, which does work for 'filtering' (putting stuff into a properties template file), so my application knows what version it is despite maven's confusion.

    The reason I wanted it in the pom file is to put the version number into a couple of minified javascript file names so they wouldn't get cached across version updates... strictly speaking this doesnt require the actual version number so I used ${maven.build.timestamp} instead which outputs the date + time of the build in the format yyyymmdd-hhmm.

    I think if I needed something more complex I'd start stripping stuff out into msbuild or something similar instead... Maven doesnt make things easy and after a year of battling it I dont really feel like its getting any better.

提交回复
热议问题