# Can't add to jar file manifest

**URL:** <https://discuss.gradle.org/t/cant-add-to-jar-file-manifest/42881>\
**Category:** Help/Discuss\
**Created:** [May 9, 2022, 6:58pm UTC](https://discuss.gradle.org/t/cant-add-to-jar-file-manifest/42881 "2022-05-09T18:58:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gjsharp](https://avatars.discourse-cdn.com/v4/letter/g/b3f665/32.png) [@gjsharp](https://discuss.gradle.org/u/gjsharp)\
**Post date:** [May 9, 2022, 6:58pm UTC](https://discuss.gradle.org/t/cant-add-to-jar-file-manifest/42881/1 "2022-05-09T18:58:23Z")

</div>

I tried adding the jar{} section to my build.gradle file to set some extra manifest entries. But none of the entries appear in the jar files produced (either the sourcesJar or the library). I suspect they are being clobbered by something in the plugins. How do I get this to work?

```gradle
import java.text.SimpleDateFormat

plugins {
    id 'java'
    id 'maven-publish'
    id 'checkstyle'
    id 'org.springframework.boot' version '2.6.6'
    id 'com.github.spotbugs' version '5.0.4'
    id 'com.google.protobuf' version '0.8.18'
}

... repos, dependencies, protobuf config, then...

task sourcesJar(type: Jar) {
    from "src/main/java"
    from "src/main/proto"
    from "src/main/resources"
    from "${buildDir}/generated/source/proto/main/grpc"
    from "${buildDir}/generated/source/proto/main/java"
    archiveClassifier = 'sources'
    dependsOn("generateProto")
}

tasks.withType(JavaCompile) {
    options.encoding = 'UTF-8'
    options.warnings = false
    dependsOn("sourcesJar")
}

java {
    withSourcesJar()
}

jar {
    manifest {
        attributes(
                'Implementation-Title': "ProjectName",
                'Implementation-Version': archiveVersion,
                'Build-Time': new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ").format(new Date())
        )
    }
}
...

```

---

<div class="post-metadata">

**Author:** ![Chris\_Dore](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/chris_dore/32/7592_2.png) [@Chris\_Dore](https://discuss.gradle.org/u/Chris_Dore)\
**Post date:** [May 10, 2022, 5:19am UTC](https://discuss.gradle.org/t/cant-add-to-jar-file-manifest/42881/2 "2022-05-10T05:19:19Z")

</div>

I suspect you’re getting tripped up by the spring boot plugin. Instead of configuring the `jar` task, configure the `bootJar` task (or configure both if that’s appropriate for your use case).

[Here’s](https://docs.spring.io/spring-boot/docs/current/gradle-plugin/reference/htmlsingle/#packaging-executable.and-plain-archives) a bit of info about the `bootJar` task.

---

<div class="post-metadata">

**Author:** ![gjsharp](https://avatars.discourse-cdn.com/v4/letter/g/b3f665/32.png) [@gjsharp](https://discuss.gradle.org/u/gjsharp)\
**Post date:** [May 10, 2022, 12:07pm UTC](https://discuss.gradle.org/t/cant-add-to-jar-file-manifest/42881/3 "2022-05-10T12:07:21Z")

</div>

Thank you. That was it.
