# GradleRunner: missing resources files in .gradle-test-kit/.../main.jar

**URL:** https://discuss.gradle.org/t/gradlerunner-missing-resources-files-in-gradle-test-kit-main-jar/47061
**Category:** Plugin Portal
**Created:** [November 23, 2023, 7:10am UTC](https://discuss.gradle.org/t/gradlerunner-missing-resources-files-in-gradle-test-kit-main-jar/47061 "2023-11-23T07:10:30Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![thomasGrabietz](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/thomasgrabietz/32/9362_2.png) [@thomasGrabietz](https://discuss.gradle.org/u/thomasGrabietz)
#### Post date: [November 23, 2023, 7:10am UTC](https://discuss.gradle.org/t/gradlerunner-missing-resources-files-in-gradle-test-kit-main-jar/47061/1 "2023-11-23T07:10:30Z")

</div>

Hallo All,  
the files under src/main/ressouces from my plugin are not included in the main.jar, which is created by the GradleRunner. So some plugin tests fail because the task under test tries to get some files from the main.jar using the zipTree function.  
How can I include them into the .jar?

Gradle Version is 7.5.1

Greetings, Tom

---

<div class="post-metadata">

### Author: ![Vampire](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/vampire/32/9082_2.png) [@Vampire](https://discuss.gradle.org/u/Vampire)
#### Post date: [November 23, 2023, 8:40am UTC](https://discuss.gradle.org/t/gradlerunner-missing-resources-files-in-gradle-test-kit-main-jar/47061/2 "2023-11-23T08:40:56Z")

</div>

If you did not mistype, then your directory is misnamed.

---

<div class="post-metadata">

### Author: ![thomasGrabietz](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/thomasgrabietz/32/9362_2.png) [@thomasGrabietz](https://discuss.gradle.org/u/thomasGrabietz)
#### Post date: [November 23, 2023, 8:57am UTC](https://discuss.gradle.org/t/gradlerunner-missing-resources-files-in-gradle-test-kit-main-jar/47061/3 "2023-11-23T08:57:26Z")

</div>

sorry for the typo. I ment src/main/resources. It’s available in the GradleRunner.pluginClasspath() but I need it in the jar in order to run the test successfully

---

<div class="post-metadata">

### Author: ![Vampire](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/vampire/32/9082_2.png) [@Vampire](https://discuss.gradle.org/u/Vampire)
#### Post date: [November 23, 2023, 10:27am UTC](https://discuss.gradle.org/t/gradlerunner-missing-resources-files-in-gradle-test-kit-main-jar/47061/4 "2023-11-23T10:27:46Z")

</div>

Ah, now I understand what you mean.  
I’d like to suggest to instead just get the file as resource instead of unzipping a jar file.  
This would be cleaner and also fix the issue you have.

If you insist on extracting the jar, you probably need to either use `withPluginClasspath` with arguments, giving the actual classpath to inject, or configure the `pluginClasspath` property on the `pluginUnderTestMetadata` task accordingly, or not use `withPluginClasspath` at all but instead publish to some local repository (not maven local) and consume the plugin in the tests from there.

---

<div class="post-metadata">

### Author: ![thomasGrabietz](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/thomasgrabietz/32/9362_2.png) [@thomasGrabietz](https://discuss.gradle.org/u/thomasGrabietz)
#### Post date: [December 13, 2023, 5:55am UTC](https://discuss.gradle.org/t/gradlerunner-missing-resources-files-in-gradle-test-kit-main-jar/47061/5 "2023-12-13T05:55:46Z")

</div>

Thank you, Björn,  
your solution to configure the `pluginClasspath` on the pluginUnderTestMetadata task works fine for us!

```gradle
tasks.pluginUnderTestMetadata {
   pluginClasspath.setFrom(tasks.jar, configurations.runtimeClasspath.get().incoming.artifactView {
       componentFilter {
           it !is OpaqueComponentIdentifier //filter out gradle api
       }
   }.files)
}

```
