Cannot exclude generated source in a multi-module gradle build
- Vorherrschende Sprache
- Java
- Sterne
- 5.6k
- Forks
- 559
- Ø Merge
- 1 T. 14 Std.
- Gemergte PRs (30 T.)
- 43
Beschreibung
Spotless error! All target files must be within the project dir.
project dir: /Users/niels/repo/sx/helium/helium-main/helium-data-model
target: /Users/niels/repo/sx/helium/helium-main/build/helium-data-model/generated/sources/xjc/java/com/soundexchange/helium/distribution/iso20022/NameAndAddress3.java'
I stepped through the build in a debugger and found that the problem lies in SpotlessTaskImpl.getOutputFile(). The call to FormatExtension.relativize returns null, which causes the exception to be thrown. relativize returns null because the targetExclude (${project.rootDir}/build/generated...) specified is not a child of the subproject directory in a multi-module build. So targetExclude can't be used to exclude generated sources from a multi-module build, because the build output is at the root directory, not the subproject directory.
_Originally posted by @niels1voo in https://github.com/diffplug/spotless/issues/399#issuecomment-1090845702_
Beitragsleitfaden
Rechercherichtung
Beginne in SpotlessTaskImpl.getOutputFile() und verfolge FormatExtension.relativize() für den targetExclude-Pfad in einem mehrmoduligen Gradle-Build. Reproduziere das gemeldete Layout aus Projektstammverzeichnis und Subprojektverzeichnis und überprüfe, dass generierte Quellen unter dem Build-Verzeichnis des Stammverzeichnisses ausgeschlossen werden können, ohne den Fehler „All target files must be within the project dir“ zu erhalten.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- java
- Bereich
- build-system
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100