# Unresolved reference: include

**URL:** <https://discuss.gradle.org/t/unresolved-reference-include/47502>\
**Category:** Help/Discuss\
**Created:** [January 23, 2024, 3:23pm UTC](https://discuss.gradle.org/t/unresolved-reference-include/47502 "2024-01-23T15:23:07Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![admund](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/admund/32/10813_2.png) [@admund](https://discuss.gradle.org/u/admund)\
**Post date:** [January 23, 2024, 3:23pm UTC](https://discuss.gradle.org/t/unresolved-reference-include/47502/1 "2024-01-23T15:23:07Z")

</div>

Hello,

I have a weird problem. I wrote a plugin in the `buildSrc` catalog, and everything works fine.  
Now I want to publish it on `https://plugins.gradle.org/` so I moved it to `:plugin` module. Everything else stays the same.  
And now I can’t build it because I’m getting an error:  
`Unresolved reference: include`

Part of the code that fails.

```gradle
            subProject.fileTree(subProject.projectDir).matching {
                this.include(listOf("**/*strings.xml"))
            }.onEach { file ->

```

When I’m removing this `incude`, I can build this `:plugin` module.  
Any ideas?

---

<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:** [January 23, 2024, 3:33pm UTC](https://discuss.gradle.org/t/unresolved-reference-include/47502/2 "2024-01-23T15:33:27Z")

</div>

You probably do not apply the `kotlin-dsl` plugin which among other things applies the `sam-with-receiver` plugin.  
So either apply the `kotlin-dsl` plugin, or do the parts it does and that you need manually, or use `it` instead of `this`.

---

<div class="post-metadata">

**Author:** ![admund](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/admund/32/10813_2.png) [@admund](https://discuss.gradle.org/u/admund)\
**Post date:** [January 23, 2024, 3:39pm UTC](https://discuss.gradle.org/t/unresolved-reference-include/47502/3 "2024-01-23T15:39:12Z")

</div>

Thank you for replying. I have `kotlin-dsl` added.

My `build.gradle.kts` file:

```gradle
plugins {
    `kotlin-dsl`
    `groovy-gradle-plugin`
    id("com.gradle.plugin-publish") version "1.2.1"
}

group = ...
version = ...

gradlePlugin {
    ...
}

dependencies {
}

```

---

<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:** [January 23, 2024, 3:43pm UTC](https://discuss.gradle.org/t/unresolved-reference-include/47502/4 "2024-01-23T15:43:10Z")

</div>

Can you share the project?

---

<div class="post-metadata">

**Author:** ![admund](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/admund/32/10813_2.png) [@admund](https://discuss.gradle.org/u/admund)\
**Post date:** [January 23, 2024, 3:49pm UTC](https://discuss.gradle.org/t/unresolved-reference-include/47502/5 "2024-01-23T15:49:45Z")

</div>

> **[GitHub - admund/MarketSpecificUI](https://github.com/admund/MarketSpecificUI)**
>
> Contribute to admund/MarketSpecificUI development by creating an account on GitHub.

---

<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:** [January 23, 2024, 4:39pm UTC](https://discuss.gradle.org/t/unresolved-reference-include/47502/6 "2024-01-23T16:39:53Z")

</div>

This is probably caused by

> The `embedded-kotlin` and `kotlin-dsl` plugins rely on features of Kotlin `1.8.20` that might work differently than in the requested version `1.9.0`.  
> Kotlin DSL property assignment is an incubating feature.

Because when you change the KGP version to 1.8.20, it works as expected.  
Or if you change the `this` to `it` it also works, but then is shown as error in the IDE.

---

<div class="post-metadata">

**Author:** ![admund](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/admund/32/10813_2.png) [@admund](https://discuss.gradle.org/u/admund)\
**Post date:** [January 23, 2024, 7:55pm UTC](https://discuss.gradle.org/t/unresolved-reference-include/47502/7 "2024-01-23T19:55:28Z")

</div>

Thank you!  
I thought that this was just a warning but fortunate, this was a main issue.  
So I downgraded the kotlin android plugin to `1.8.22` and compose-compiler to `1.4.6`, and started working.  
Now I need to figure out how to bring back the newest Kontlin android plugin.
