Created
March 24, 2017 11:54
-
-
Save DaddyMoe/8d7e6ee735cb1dda75f9be8204decce5 to your computer and use it in GitHub Desktop.
Dynamically set API version in code from pom.xml. Great on CI where one is not manually tempering with versions.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-jar-plugin</artifactId> | |
<configuration> | |
<archive> | |
<manifest> | |
<addDefaultImplementationEntries>true</addDefaultImplementationEntries> | |
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries> | |
</manifest> | |
</archive> | |
</configuration> | |
</plugin | |
<!-- Then in Code `getClass().getPackage().getImplementationVersion()` --> | |
<!-- For Example to set API on Swagger do: | |
private ApiInfo apiInfo() { | |
return new ApiInfoBuilder() | |
.version(getClass().getPackage().getImplementationVersion()) | |
.build(); | |
} | |
--> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment