Joseph,

you probably want to look into resource filtering and put a
corresponding placeholder into a properties file and read it as a
classpath resource from your artifact.

https://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html

Cheers
-- 
Alexander Kriegisch
https://scrum-master.de


Joseph Kessselman schrieb am 09.11.2023 07:17 (GMT +07:00):

> For obvious reasons, if would be nice if the -version option on my 
> project automatically reported the version I'd set in the pom.xml rather 
> than my trying to synchronize the two manually.
> 
> The best approaches I've found so far are in
> https://stackoverflow.com/questions/2712970/get-maven-artifact-version-at-runtime
> ... but there's a note that at least one of them doesn't work in all 
> classloaders, or in openjdk.
> 
> I'm willing to have the pom write this into a file that the Java code 
> would query, if that's what it takes to have a portable solution, but 
> I'm not sure what the best way to express that would be.
> 
> 
> There must be an established Best Practices solution for this, right?
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to