Gradle let’s you customize archive manifest from the get go, you just have to add entries you desired to the manifest’s attributes. Gradle Kotlin DSL: set main class attribute for jar - build.gradle.kts Alrighty the solution was to update gradle on build.gradle of my project, not module // Top-level build file where you can add configuration options common to all sub-projects/modules. To raise new issues or bugs against Gradle, please use, https://github.com/gradle/gradle/blob/master/subprojects/osgi/src/main/groovy/org/gradle/api/internal/plugins/osgi/DefaultOsgiManifest.java#L90, https://github.com/jetztgradnet/gradle-web-bundle, jetztgradnet-gradle-web-bundle-4fce0ff.zip. Personally I’d like to find out the following information when inspecting the metadata for a particular artifact: Let’s start with Gradle as it’s the one that requires less setup. Both Gradle 0.9.2 and 1.0-milestone-1 fail to build the war's MANIFEST.MF when called like this: As you can see we get the expected result. Try Jira - bug tracking software for your team. When packaging the project we get a manifest that may look like this. In this case we must also configure an external plugin in order to grab hold of SCM properties, we’ll use the maven-git-commit-id-plugin from Konrad (@ktosopl); we’ll also need to update the configuration of the core maven-jar-plugin as explained here. Notify me of follow-up comments by email. $ jar tvf build/libs/gs-gradle-0.1.0.jar 0 Fri May 30 16:02:32 CDT 2014 META-INF/ 25 Fri May 30 16:02:32 CDT 2014 META-INF/MANIFEST.MF 0 Fri May 30 16:02:32 CDT 2014 hello/ 369 Fri May 30 16:02:32 CDT 2014 hello/Greeter.class 988 Fri May 30 16:02:32 CDT 2014 hello/HelloWorld.class Perhaps you may be thinking in using the antrun plugin with a short embedded script to be able to get around this problem, well, if you need to bring a second build tool in order to fix the shortcomings of the first, isn’t the problem somewhere else? Manifest-Version is set to 1.0; Specification-Title and Implementation-Title are set to the Gradle rootProject.name; Specification-Version and Implementation-Version are set based on Git commit status (see git describe) IFF no version can be determined via a git describe, and a Gradle rootProject.version can be, this value will be used instead Powered by a free Atlassian Jira open source license for Gradle Inc. Take a second to support aalmiray on Patreon! Please check the checkbox to ensure that you comply with the EU Laws. (the Git commit hash for example). It looks quite similar to the one generated by Gradle with just the timestamp and the creator having different values. Which operating system was used to built it. jar { LinkedHashMap attributes = new LinkedHashMap() attributes.put('Build-Date', new Date().format("yyyy-MM-dd")) attributes.put('Build-Time', new Date().format("HH:mm:ssZ")) attributes.put('Code-Revision', '1.0') attributes.put( 'Class-Path', configurations.compile.collect { it.getName() }.join(' ')) manifest.mainAttributes(attributes) } Learn how your comment data is processed. We could write down said metadata to a properties file and add it to the package archive, or we could reuse an existing facility: the archive’s manifest. For my simple test case I can live with the workaround, as I don't need Bnd to calculate imports or exports, but for real web bundles, this is a problems that needs to be resolved. One option we have to mitigate this problem is to provide additional metadata as part of the artifact’s archive. The OSGI plugin updates the MANIFEST.MF with a new Bnd-LastModified even if there is no other change, resulting in the jar task always executing. An advantage of using Gradle is that attribute values may be computed on the spot, as you have access to a full programming language (either Groovy or Kotlin), useful when you may need to trim, modify, and/or format certain values. There’s a catch though, Gradle does not know a thing about SCM properties, you’ll have to add a plugin that exposes this information, such as the net.nemerosa.versioning plugin. you find that the artifact in production is not the right one even though the version appears to be the correct one. This site uses Akismet to reduce spam. There’s a catch though, Gradle does not know a thing about SCM properties, you’ll have to add a plugin that exposes this information, such as … Next is Maven. Just like in Gradle, the build file has access to all System properties we need (more information about project properties can be found at this link). In any case, both build tools provide you the means to add essential artifact metadata to the archive’s manifest. Hi all, I'm building a web app as OSGi bundle (web bundle), so I use both the OSGi and war plugins. I posted an example project at https://github.com/jetztgradnet/gradle-web-bundle.