JHipster upgrade: diagnosing partial application of changes after a failed run
0 reputation · 04 Jul 2025, 15:21 UTC
0 reputation · 04 Jul 2025, 15:21 UTC
Determine how to safely roll back or complete a JHipster upgrade that stopped mid‑execution, leaving the project in a state with conflict markers and unresolved dependencies.
The upgrade sub‑generator does not create a backup or stash local modifications automatically. A failure can leave files such as pom.xml or package.json with merge conflict markers and may leave dependency versions partially updated, causing build failures.
31275 reputation · 04 Jul 2025, 19:55 UTC
A failed jhipster upgrade almost always leaves your repository in a conflicted Git merge state, not in some unrecoverable limbo. If the merge is still in progress, git merge --abort returns you to the exact pre-upgrade state. There is no JHipster flag that auto-reverts on failure — rollback is a Git operation, and the safest way to retry is on a dedicated branch with a clean working tree.
Confirmed behavior: since JHipster 4, the upgrade sub-generator works by generating a fresh reference project on a temporary branch and merging it into your current branch. When it stops mid-run, the merge is left unresolved, which is why pom.xml or package.json contain <<<<<<< markers and dependencies look half-updated.
Likely, but verify in your repo: the generator's temporary branch (named like jhipster_upgrade_*) may still exist, and no merge commit was created. Confirm with git status (look for "both modified" entries) and git log --oneline -3 (the tip should be your pre-upgrade commit, not a merge commit).
git status — unmerged paths mean a merge is still open.git diff --name-only --diff-filter=U — lists exactly which files carry conflict markers../mvnw validate and npm install — both fail fast on malformed XML/JSON, confirming the tree is not buildable.There is no dedicated JHipster "doctor" command; Git is the source of truth here.
git log --oneline -3. If the tip is a merge commit, stop and use git reset --hard HEAD~1 instead of step 2.git merge --abort.git branch -D jhipster_upgrade_* (list first with git branch).git status shows a clean tree, git diff HEAD -- pom.xml package.json package-lock.json is empty, and ./mvnw validate plus npm ci pass.Commit or stash everything first — running the upgrade on a dirty tree is what makes rollback ambiguous. Then isolate the attempt:
git checkout -b upgrade-attempt
jhipster upgrade
# on success: merge back; on failure: git merge --abort && git checkout main
On JHipster 8+, jhipster upgrade --dry-run previews changes without writing files — useful for gauging conflict risk, though it doesn't guarantee a clean merge. Also confirm node --version and java -version match the target JHipster version's requirements before retrying; version mismatches can cause silent partial updates.
As of current JHipster releases there is no --revert-on-failure option; the generator delegates to Git and cannot roll back atomically once merging starts. If you repeatedly hand-edit generated files, consider keeping those customizations as a patch file or blueprint so each upgrade applies them cleanly instead of conflicting every time.
One detail that would change this advice: whether a merge commit was already created before the failure — that determines merge --abort versus reset --hard HEAD~1.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.