Scope jython3.test's build resource to stop target/ self-recursing#493
Merged
khatchad merged 1 commit intoMay 7, 2026
Merged
Conversation
…sively into itself.
`com.ibm.wala.cast.python.jython3.test/pom.xml` declares its build resource
as the module root:
```xml
<resources>
<resource>
<directory>.</directory>
</resource>
</resources>
```
Maven copies that into `target/classes/` on every build. Since `target/`
is at the module root, the second build copies the previous build's
`target/` into `target/classes/target/`; the third copies that into
`target/classes/target/classes/target/`; and so on. Each level includes
the module's own `*-SNAPSHOT.jar`, so disk usage grows exponentially
— on a local checkout this had reached 99 GB after a handful of
`mvn install` cycles.
Sibling `com.ibm.wala.cast.python.test/pom.xml` does it correctly with
`<directory>data</directory>` (scoped to a specific source directory).
This PR scopes the jython3.test resource to just the three entries that
need to be on the classpath (`META-INF/`, `build.properties`,
`logging.properties`) via an `<includes>` filter, so `target/` is never
captured.
Verified locally: two consecutive `mvn clean install` + `mvn install`
cycles produce a `target/classes/` containing only the expected
resources (`META-INF/`, `build.properties`, compiled `com/`); no
self-referential `target/` directory; total `target/` size 184 KB.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #493 +/- ##
============================================
- Coverage 57.93% 57.91% -0.02%
+ Complexity 625 624 -1
============================================
Files 111 111
Lines 7671 7671
Branches 856 856
============================================
- Hits 4444 4443 -1
- Misses 3049 3050 +1
Partials 178 178 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
Adjusts the Maven resource configuration for jython/com.ibm.wala.cast.python.jython3.test to prevent target/ from being recursively copied into build outputs across repeated builds, addressing the exponential disk growth reported in #494.
Changes:
- Scopes the module’s build resources (still rooted at
.) using an explicit<includes>list. - Limits copied resources to
META-INF/**,build.properties, andlogging.propertiesto avoid pulling intarget/on subsequent builds.
3 tasks
msridhar
approved these changes
May 7, 2026
github-merge-queue Bot
pushed a commit
to ponder-lab/ML
that referenced
this pull request
May 8, 2026
…sively into itself. (#265) Fork-side companion to wala#493 (which fixes the same bug at upstream's `jython/com.ibm.wala.cast.python.jython3.test/pom.xml`). On the fork the module sits at the repo root (`com.ibm.wala.cast.python.jython3.test/`) rather than under `jython/`, but the pom is otherwise identical and has the same recursive-resource bug: ```xml <resources> <resource> <directory>.</directory> </resource> </resources> ``` Maven copies the resource directory into `target/classes/` on every build. Since `target/` is itself at the module root, repeated rebuilds nest `target/classes/target/classes/target/...` — a local checkout hit 99 GB before being noticed. Sibling `com.ibm.wala.cast.python.test/pom.xml` does it correctly with `<directory>data</directory>`. That sibling has no Eclipse PDE bundle metadata at the module root, so the single-subdir pattern works there. This module ships Eclipse PDE metadata (`META-INF/MANIFEST.MF`, `build.properties`, `logging.properties`) that downstream OSGi consumers expect at the bundle root, so a direct port of the sibling pattern would either drop those resources or break Eclipse PDE. Scoping via an explicit `<includes>` filter listing the three resource entries preserves the JAR contents while excluding `target/` from the resource scope. Verified locally: two consecutive `mvn clean install` + `mvn install` cycles produce a flat `target/classes/` (`META-INF/`, `build.properties`, `logging.properties`, compiled `com/`); no `target/classes/target/` recursion; total `target/` size 184 KB.
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes wala/ML#494.
Problem
jython/com.ibm.wala.cast.python.jython3.test'spom.xmldeclares its build resource as the module root:Maven copies that into
target/classes/on every build. Sincetarget/is itself at the module root, the second build copies the previous build'starget/intotarget/classes/target/; the third copies that intotarget/classes/target/classes/target/; and so on. Each level contains the module's own*-SNAPSHOT.jar, so disk usage grows exponentially — on a local checkout this had reached 99 GB after a handful ofmvn installcycles. See #494 for the full diagnosis.Fix
Scope the resource via an explicit
<includes>filter listing the three entries that need to be on the classpath (META-INF/**,build.properties,logging.properties). This preserves the JAR contents while excludingtarget/from the resource scope.Why an
<includes>filter rather than a different<directory>Looked at the sibling
com.ibm.wala.cast.python.test/pom.xml, which scopes its resource as<directory>data</directory>— the cleanest pattern. It doesn't directly apply here because that sibling has noMETA-INF/orbuild.propertiesat the module root (its only resource is thedata/subdir). This module ships Eclipse PDE metadata that needs to live at the bundle root:META-INF/MANIFEST.MFBundle-SymbolicName,Export-Package,Require-Bundle); Eclipse PDE looks for it at the bundle rootbuild.propertiessource../bin.includes)Both currently ship in the Maven JAR (verified via
jar tf); moving them under a singleresources/subdir would break Eclipse PDE consumers. So the minimal fix that preserves current JAR contents is an explicit<includes>filter.(The
logging.propertiesentry preserves the current intent — it's a symlink to../logging.properties, which is broken in master today and silently skipped by Maven; keeping the include is harmless and avoids a behavior delta if the symlink target ever returns.)Verification
Two consecutive build cycles on the patched module:
Result:
No self-referential
target/classes/target/, no jar-of-jars-of-jars. Total moduletarget/size 184 KB (vs. 99 GB pre-fix on multi-build accumulations).Test plan
target/classes/(above).META-INF/MANIFEST.MF,build.properties,META-INF/maven/...).