1

Using maven, I would like to get the my project version within spring but without filtering. I tried it like this

@PropertySource("classpath:META-INF/maven/groupId/artifactId/pom.properties")

as proposed here: Access maven project version in Spring config files

As written there it is not possible with test or jetty:run. maven is generating the META-INF only in the packaged archive. Is there a way to instruct maven to generate META-INF before so you can start jetty:run, let spring read the project version from manifest without getting an error?

Community
  • 1
  • 1
Janning Vygen
  • 8,877
  • 9
  • 71
  • 102

2 Answers2

1

If it's just for test purposes, you could just create a pom.properties sample file in the src/webapp/META-INF/..../ directory in your source tree?

Cheers,

Anders R. Bystrup
  • 15,729
  • 10
  • 59
  • 55
0

You can maintain the version number in a project.properties file also and then access the version number from the project.properties file in the java code. Hope this helps you.

Japan Trivedi
  • 4,445
  • 2
  • 23
  • 44