I would like to write an Integration Test which test if the created jar behaves like expected. For that I have to know the path to the jar as well the name, but how to I get this Information. I do not like the idea of hard coding this. Is there a way to get the Information from maven? Or what is the best practice for that?
Assembled jar is placed inside directory which is accessible from maven properties
${project.build.directory}
Jar name is configured in Maven Assembly Plugin or assembly descriptor. For simplicity define property project.build.finalName
in your pom.xml
.
<properties>
<project.build.finalName>my-artifact.jar</project.build.finalName>
</properties>
After this your jar is accessible with variable:
${project.build.directory}/my-artifact.jar
Simply filter this value with maven into application properties and voila :)
Is this helping you in any way?