Skip to content
This repository has been archived by the owner on Jan 27, 2020. It is now read-only.

Commit

Permalink
Add snippet configuring IDEA plugin with Gradle 5.2 generatedSourcesDirs
Browse files Browse the repository at this point in the history
  • Loading branch information
tbroyer committed Feb 3, 2019
1 parent b96813a commit e207340
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,51 @@ idea {

</details>

<details>
<summary>With Gradle 5.2 (and a version of IntelliJ IDEA older than 2019.1)</summary>

You can instead use:

<details open>
<summary>Groovy</summary>

```gradle
// Workaround for https://youtrack.jetbrains.com/issue/IDEA-182577
idea {
module {
sourceDirs += sourceSets.main.output.generatedSourcesDirs
generatedSourceDirs += sourceSets.main.output.generatedSourcesDirs
testSourceDirs += sourceSets.test.output.generatedSourcesDirs
generatedSourceDirs += sourceSets.test.output.generatedSourcesDirs
}
}
```

</details>
<details>
<summary>Kotlin</summary>

```kotlin
// Workaround for https://youtrack.jetbrains.com/issue/IDEA-182577
idea {
module {
tasks.sourceSets.getByName(SourceSet.MAIN_SOURCE_SET_NAME).output.generatedSourcesDirs.also {
// For some reason, modifying the existing collections doesn't work. We need to copy the values and then assign it back.
sourceDirs = sourceDirs + it
generatedSourceDirs = generatedSourceDirs + it
}
tasks.sourceSets.getByName(SourceSet.TEST_SOURCE_SET_NAME).output.generatedSourcesDirs.also {
// For some reason, modifying the existing collections doesn't work. We need to copy the values and then assign it back.
testSourceDirs = testSourceDirs + it
generatedSourceDirs = generatedSourceDirs + it
}
}
}
```

</details>
</details>

If you want IntelliJ IDEA to process annotations, you'll have to do some manual configuration to enable annotation processing,
and add the annotation processors to the project's compilation classpath:

Expand Down

0 comments on commit e207340

Please sign in to comment.