I would like to embed dependency information into my manifest file, so that I can expose this information at runtime. i.e. I can see which version of a library is used by a particular running instance of my service.
I'm using gradle to build my 'fatjar':
shadowJar {
mergeServiceFiles()
archiveName "service.jar"
exclude "META-INF/*.SF"
exclude "META-INF/*.DSA"
exclude "META-INF/*.RSA"
manifest {
attributes('Main-Class': "service.Service",
'Built-By': System.getProperty('user.name'),
'Built-Date': new Date(),
'Built-JDK': System.getProperty('java.version'),
'Implementation-Version': version,
'Implementation-Title': project.name)
}
}
And I have dependencies on various other libraries:
dependencies {
compile group: 'mysql', name: 'mysql-connector-java', version: '5.1.39'
...
}
How can I add the dependency information into my manifest file? For example:
Manifest-Version: 1.0
Implementation-Title: service
Implementation-Version: Local Build
Built-By: me
Built-Date: Wed Jun 22 14:13:53 BST 2016
Built-JDK: 1.8.0_91
Main-Class: service.Service
Dependency-mysql-connector-java: mysql:mysql-connector-java:5.1.39