[
https://issues.apache.org/jira/browse/GROOVY-12005?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Paul King updated GROOVY-12005:
-------------------------------
Description:
h2. Grape robustness measures
Two complementary cache-validation guards plus a CDN compatibility fix,
addressing
hard-to-diagnose @Grab failures caused by half-populated caches and Cloudflare's
recent filtering of the JDK URLConnection default User-Agent.
h3. Cache resilience
* New {{StrictLocalM2Resolver}} (extends {{IBiblioResolver}}) — rejects a
{{localm2}} entry when its POM has no JAR alongside (typical
{{staged-releases}} lineage). Resolution falls through to {{ibiblio}}
instead of failing with "download failed". Default-on; opt-out
{{-Dgroovy.grape.strict-localm2=false}}.
* New {{StrictCachedGrapesResolver}} (extends {{FileSystemResolver}},
{{descriptor="required"}}) — refuses to synthesise stub descriptors from
artifact-only state, and refuses cached ivy descriptors lacking the
companion {{.original}} POM (which signals a previously-synthesised stub).
Self-heals existing corruption by forcing fall-through. Default-on; opt-out
{{-Dgroovy.grape.strict-cached-grapes=false}}.
h3. CDN compatibility
* {{GrapeIvy}} static initializer sets {{http.agent}} to a Maven-shaped
User-Agent {{Apache-Maven/x.y.z (Java X; OS X)}}, since Maven Central
(Fastly) returns HTTP 404 to the JDK default {{Java/<version>}}.
Covers CLI and standalone script use.
* Build plugin {{org.apache.groovy-tested}} sets the same value as a JVM
arg for test JVMs (static init runs too late for already-warm test JVMs).
* {{ForkedJvmExtension}} always inherits {{http.agent}} into child JVMs.
h3. Diagnostics & generality
* {{GrapeIvy.getDependencies}} now appends an actionable hint when a failure
matches the half-populated {{localm2}} pattern, naming the artifact, the
cache paths to clean, and the {{mvn dependency:get}} command.
* Test plugin generically forwards any {{groovy.grape.*}} system or project
property to test JVMs (covers strict-localm2, strict-cached-grapes, plus
any future flag).
h3. Test infrastructure
* CI workflow pre-warms {{~/.m2/repository}} via {{mvn dependency:get}}
for every {{@Grab}} coord discovered in test sources (Maven uses
Apache HttpClient and isn't filtered by Cloudflare). Bridge copies
the warm cache into each test task's isolated temp at task start.
* {{actions/cache}} extended to persist {{~/.m2/repository}} alongside
{{~/.groovy/grapes}} between runs.
> Harden Grape against cache corruption and CDN throttling
> --------------------------------------------------------
>
> Key: GROOVY-12005
> URL: https://issues.apache.org/jira/browse/GROOVY-12005
> Project: Groovy
> Issue Type: Improvement
> Components: Grape
> Reporter: Paul King
> Assignee: Paul King
> Priority: Major
>
> h2. Grape robustness measures
> Two complementary cache-validation guards plus a CDN compatibility fix,
> addressing
> hard-to-diagnose @Grab failures caused by half-populated caches and
> Cloudflare's
> recent filtering of the JDK URLConnection default User-Agent.
> h3. Cache resilience
> * New {{StrictLocalM2Resolver}} (extends {{IBiblioResolver}}) — rejects a
> {{localm2}} entry when its POM has no JAR alongside (typical
> {{staged-releases}} lineage). Resolution falls through to {{ibiblio}}
> instead of failing with "download failed". Default-on; opt-out
> {{-Dgroovy.grape.strict-localm2=false}}.
> * New {{StrictCachedGrapesResolver}} (extends {{FileSystemResolver}},
> {{descriptor="required"}}) — refuses to synthesise stub descriptors from
> artifact-only state, and refuses cached ivy descriptors lacking the
> companion {{.original}} POM (which signals a previously-synthesised stub).
> Self-heals existing corruption by forcing fall-through. Default-on; opt-out
> {{-Dgroovy.grape.strict-cached-grapes=false}}.
> h3. CDN compatibility
> * {{GrapeIvy}} static initializer sets {{http.agent}} to a Maven-shaped
> User-Agent {{Apache-Maven/x.y.z (Java X; OS X)}}, since Maven Central
> (Fastly) returns HTTP 404 to the JDK default {{Java/<version>}}.
> Covers CLI and standalone script use.
> * Build plugin {{org.apache.groovy-tested}} sets the same value as a JVM
> arg for test JVMs (static init runs too late for already-warm test JVMs).
> * {{ForkedJvmExtension}} always inherits {{http.agent}} into child JVMs.
> h3. Diagnostics & generality
> * {{GrapeIvy.getDependencies}} now appends an actionable hint when a failure
> matches the half-populated {{localm2}} pattern, naming the artifact, the
> cache paths to clean, and the {{mvn dependency:get}} command.
> * Test plugin generically forwards any {{groovy.grape.*}} system or project
> property to test JVMs (covers strict-localm2, strict-cached-grapes, plus
> any future flag).
> h3. Test infrastructure
> * CI workflow pre-warms {{~/.m2/repository}} via {{mvn dependency:get}}
> for every {{@Grab}} coord discovered in test sources (Maven uses
> Apache HttpClient and isn't filtered by Cloudflare). Bridge copies
> the warm cache into each test task's isolated temp at task start.
> * {{actions/cache}} extended to persist {{~/.m2/repository}} alongside
> {{~/.groovy/grapes}} between runs.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)