Skip to content

Keep modules named build or target in the project scan - #2124

Open
Medamineelkhattabi wants to merge 2 commits into
LemonAppDev:developfrom
Medamineelkhattabi:fix-build-output-named-module
Open

Medamineelkhattabi wants to merge 2 commits into
LemonAppDev:developfrom
Medamineelkhattabi:fix-build-output-named-module

Conversation

@Medamineelkhattabi

@Medamineelkhattabi Medamineelkhattabi commented Nov 8, 2026 •

Copy link
Copy Markdown

Fixes the case reported in #2123: a Gradle or Maven module whose directory is named build or target (e.g. feature/target) is skipped by the project scan, so it is missing from scopeFromProject(), scopeFromProduction() and the module and source set scopes, with no warning.

ProjectDirectoryFilter treats every build/target segment before the first src as build output. With this change such a directory is still pruned unless it is a module directory itself, checked with the isModuleDirectory the filter already uses. A module's own build/ and target/ output stays ignored, and packages named build/target under src behave as before.

Tests:

  • ProjectDirectoryFilterTest: module directories named build and target are not ignored, and their own output directories still are.
  • ProjectKotlinFileScannerTest: an end-to-end case on a temp directory with a Gradle module named build and a Maven module named target.

Locally (JDK 25): spotlessCheck and detektCheck pass, and lib:test passes (2,809 tests, 5 skipped on Windows by @EnabledOnOs). The new tests fail without the change.

One behaviour change to be aware of: a build/target directory that directly contains a build file or a src directory is now scanned, so a generator writing a complete project straight into build/ would be picked up.

CI: all test, lint and detekt jobs pass. The two snapshot jobs (Publish Snapshot To Maven Central and Get Published Snapshot For Test Projects) fail because the Maven Central secrets aren't available to PRs from forks.

@Medamineelkhattabi
Medamineelkhattabi marked this pull request as ready for review November 8, 2026 22:39
… modules

Add KDoc note that a build or target directory detected as a module
directory is scanned with all its content. Add scanner test for output
directory containing src or a build file, and scope tests for modules
named build and target.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants