How can I get the version of the application (defined by tag version im pom) in quarkus specially?

前端 未结 2 1150
夕颜
夕颜 2021-01-28 02:48

I moved from a plain Java EE application to quarkus.io. In Java EE I had the a properties file with version=${project.version} and reeading this file in an JAX RS

相关标签:
2条回答
  • 2021-01-28 03:20

    Try

    
    @ConfigProperty(name = "quarkus.application.version")
    String version;
    

    Also you can read the Implementation-Version from the manifest.

    0 讨论(0)
  • 2021-01-28 03:28

    I'm not sure if my approach is the best case scenario but you can try this:

    pom.xml :

    <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>**/application.properties</include>
                </includes>
            </resource>
       </resources>
    

    In application.properties use version property:

    quarkus.version=${quarkus.platform.version}
    

    Then use it as a config property:

    @ConfigProperty(name = "quarkus.version")
    String version;
    
    0 讨论(0)
提交回复
热议问题