This task has been canceled!
6
Created by
johndon 216 about 3 years ago
I want to specify a version of my software in the gradle e.g. like this:
project(':my-application') {
apply plugin: 'org.springframework.boot'
version = '1.x.x'
dependencies {
...
}
}
Now when making a gradle build this 1.x.x
version should be part of the jar. Also I want to be able to access this version from within my beans:
@Component
public class ApplicationStartup implements ApplicationListener<ContextRefreshedEvent> {
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
logger.info("Starting my application");
// prints version 1.1.x
logger.info("Version of my app is: {}", version);
}
}
See task infos
There is a typo. In it.replace('%projectVersion%', .version) you need to remove the dot before version
0