How to show application version in UI?

Hi.
I’m using vaadin 14 and would like to show the version number of my application (not the framework version) in the UI.
Since build and versioning is done via maven, how to get the version number programatically from pom.xml tag?

pom.xml:

<project>
    <modelVersion>4.0.0</modelVersion>
    <groupId>tld.company</groupId>
    <artifactId>my-application-name</artifactId>
    <version>1.0.4-SNAPSHOT</version>
    <packaging>jar</packaging>
	...
</project>

Thanks for help.
Torsten

Hello Torsten

I’ve asked the same question [here]
(https://stackoverflow.com/q/53667295/3441504).

According to the answers from Vaadin experts, you can do this if using Vaadin 14 or higher

VaadinCoreShrinkWrap.class.getAnnotation(NpmPackage.class).version();

And here’s the explanation to why that info is no longer easily available:

Leif Åstrand
Starting from 10, a Vaadin version doesn’t have any content of its own, not even a version number marker. It’s only a set of dependency versions that have been tested to work well together.

com.vaadin.flow.server.Version.getFullVersion() gives the version of the Vaadin Flow dependency. This is in most cases a more relevant version number to look at for technical purposes.

Vaadin 10 and Vaadin 11 used Flow 1.0.x, whereas Vaadin 12 uses version 1.2.x. Vaadin 13 will most likely use Flow version 1.3.x or 2.0.x, depending on how big changes will be included by then.

Hi Kaspar.

I would like to get the version of my application, not the version of vaadin or any dependency.
Perhaps it was not clear enough. So I added the pom part in my initial post.

Bye,
Torsten

Ah, okay. That’s not easily possible out-of-the-box, but there are ways how you can achieve that.
[This stackoverflow post]
(https://stackoverflow.com/q/3697449/3441504) has several answers that seem to work.

Thanks again. I knew the generic solutions via Manifest but hoped Vaadin already implemented this in any magic way. :wink:
So I’ll pull out our old ManifestReader…

This one was really helpful for me: https://docs.spring.io/spring-boot/docs/2.3.x/reference/html/howto.html#howto-properties-and-configuration