Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Versions in Java

I have to manage a Java build, and I don't know how to best manage the software's version so that it can be displayed on an about dialog etc.

How do you people do it? We are using Maven, can I somehow reuse the version as defined in pom.xml? I'd also be interested to know how it's usually done with Ant.

like image 246
forneo Avatar asked Jan 21 '23 02:01

forneo


1 Answers

You can get the Maven version of the jar by loading the pom.properties file. This is automatically created by Maven in the jars.

Should be located inside the jar, at this path

META-INF\maven\{groupId}\{artifactId}\pom.properties

This is mentioned a little bit more here.

like image 96
Andy Avatar answered Jan 29 '23 02:01

Andy