DEV Community

Query Filter
Query Filter

Posted on

docker111

import java.text.SimpleDateFormat

jar {
    archiveBaseName = project.ext.artifactId
    archiveVersion = project.ext.version

    // Create a timestamp string
    def buildDate = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(new Date())

    manifest {
        attributes(
            "Built-By": System.getProperty("user.name"),
            "Implementation-Version": archiveVersion,
            "Build-Date": buildDate, // New attribute
            "Build-Jdk": "${System.getProperty('java.version')} (${System.getProperty('java.vendor')})",
            "Build-OS": "${System.getProperty('os.name')} ${System.getProperty('os.arch')}",
            "Compile-Source-JDK": project.sourceCompatibility,
            "Compile-Target-JDK": project.targetCompatibility
        )
    }
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)