Reputation: 101
I want to read the current artifact version of my maven-project inside my of a RESTful service. My code is written in JAX-RS (Quarkus).
I am using a the following pom.xml
snippet:
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<version>${quarkus.version}</version>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>
I read the version with the following java snippet:
String vendor = getClass().getPackage().getImplementationVendor();
It seems to me that the quarkus-maven-plugin
is ignoring that line since maven-jar-plugin
is working perfectly fine (I used this in a different project):
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
I do not have a really profound knowledge of maven and quarkus yet.
Am I making a mistake setting up the quarkus-maven-plugin
?
Is there a workaround which does not include reading directly from the pom.xml
?
Thank you for helping me.
EDIT: I will mark this thread as "answered" as soon as the following issue is resolved (opend by @Guillaume Smet): https://github.com/quarkusio/quarkus/issues/5023
EDIT: Issue is resolved as of today. https://github.com/quarkusio/quarkus/issues/5100
Upvotes: 1
Views: 849
Reputation: 10539
Adding addDefaultImplementationEntries
won't help, we build the jar ourselves and we don't push any of this information to it.
I created https://github.com/quarkusio/quarkus/issues/5023 for this.
For the time being, you can either push the information to the manifest yourselves (we enhance it if you have an existing one) or inject the values we derive from the POM files in your REST resources with:
@ConfigProperty(name = "quarkus.application.name")
String name;
@ConfigProperty(name = "quarkus.application.version")
String version;
Upvotes: 1