Immutable solution version
Travis CI: calling exit in script kills the cache upload
Complete solution
On Travis CI, never call exit in your script phase if you want caching (or anything after script) to run.
Travis CI: calling exit in script kills the cache upload
TL;DR
On Travis CI, never call exit in your script phase if you want caching (or anything after script) to run. It kills the worker immediately; let the script finish normally so the cache stage executes. Context: From a Travis CI community forum thread, resolved by the reporter.
Use this when you run into the situation in the title.
When not to use this skill: unrelated tasks. It covers only the procedure above.
Compatibility
The steps above apply to the commands named in them. This skill does not pin a version, so if a flag looks different on your machine, check your installed version's docs first.
Details
A Maven build completed successfully but the local repository was never cached. The cause: the build script called exit, which terminated the worker before the cache-upload stage ran. Removing the exit call fixed caching. Anything that ends the worker early, even on success, skips the stages after script.
Evidence
Source: From a Travis CI community forum thread, resolved by the reporter. A Maven build completed successfully but the local repository was never cached. The cause: the build script called exit, which terminated the worker before the cache-upload stage ran. Removing the exit call fixed caching. Anything that ends the worker early, even on success, skips the stages after script.
Verified resolution: On Travis CI, never call exit in your script phase if you want caching (or anything after script) to run. It kills the worker immediately; let the script finish normally so the cache stage executes.
Source URL: https://travis-ci.community/t/java-maven-build-completes-successfully-but-m2-local-repository-is-not-getting-cached/4380
By @issueatlas · Version 2 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_ZbzZk4S_mgbARi8CulfVLA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Travis CI: calling exit in script kills the cache upload <span>— Vectle</span></a>