generator-jhipster
generator-jhipster copied to clipboard
`npx jhipster upgrade` doesn't work to upgrade an app from 8.3.0 to 8.4.0
Overview of the issue
I tried to use npx jhipster upgrade to upgrade my jhipster8-demo project from 8.3.0 to 8.4.0. I know I could use the migrate blueprint, but I figured it'd be good to test the upgrade instructions.
The first time I tried it, the only thing the process changed was the package-lock.json file. It did not upgrade package.json to use 8.4.0 or modify any other files. I figured this might be caused by existing branches, so I deleted all the branches and tried again. The behavior is the same.
Motivation for or Use Case
Our upgrade instructions should work. If npx jhipster upgrade is not working, we should recommend the migrate blueprint first.
Reproduce the error
git clone https://github.com/mraible/jhipster8-demo.git
cd jhipster8-demo
npm install
npx jhipster upgrade
Related issues
https://github.com/jhipster/generator-jhipster/issues/25033
Suggest a Fix
Update the documentation to recommend the migrate blueprint, change the upgrade command so it works.
JHipster Version(s)
[email protected] /Users/mraible/dev/jhipster8-demo
├─┬ [email protected]
│ └── [email protected] deduped
└── [email protected]
JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
{
"generator-jhipster": {
"applicationType": "monolith",
"authenticationType": "jwt",
"baseName": "blog",
"blueprints": [
{
"name": "generator-jhipster-migrate",
"version": "1.0.0"
}
],
"buildTool": "maven",
"cacheProvider": "ehcache",
"clientFramework": "angular",
"clientTestFrameworks": [
"cypress"
],
"clientTheme": "none",
"creationTimestamp": 1702525034689,
"cypressAudit": true,
"cypressCoverage": true,
"databaseType": "sql",
"devDatabaseType": "h2Disk",
"devServerPort": 4200,
"enableGradleEnterprise": null,
"enableHibernateCache": true,
"enableSwaggerCodegen": false,
"enableTranslation": true,
"entities": [
"Blog",
"Post",
"Tag"
],
"feignClient": false,
"gradleEnterpriseHost": null,
"herokuAppName": "jhipster8-demo",
"herokuDeployType": "git",
"herokuJavaVersion": "21",
"jhipsterVersion": "8.3.0",
"languages": [
"en",
"es"
],
"lastLiquibaseTimestamp": 1710952227000,
"messageBroker": false,
"microfrontend": null,
"microfrontends": [],
"nativeLanguage": "en",
"packageName": "org.jhipster.blog",
"prodDatabaseType": "postgresql",
"reactive": false,
"searchEngine": false,
"serverPort": null,
"serverSideOptions": [],
"serviceDiscoveryType": false,
"testFrameworks": [
"cypress"
],
"websocket": false,
"withAdminUi": true
}
}
Environment and Tools
openjdk version "17.0.11" 2024-04-16 OpenJDK Runtime Environment Temurin-17.0.11+9 (build 17.0.11+9) OpenJDK 64-Bit Server VM Temurin-17.0.11+9 (build 17.0.11+9, mixed mode)
git version 2.39.3 (Apple Git-146)
node: v20.12.1 npm: 10.7.0
Docker version 26.0.0, build 2ae903e
JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions
@ChangelogDate("20240320163025")
entity Blog {
name String required minlength(3)
handle String required minlength(2)
}
@ChangelogDate("20240320163026")
entity Post {
title String required
content TextBlob required
date Instant required
}
@ChangelogDate("20240320163027")
entity Tag {
name String required minlength(2)
}
relationship ManyToOne {
Blog{user(login)} to User with builtInEntity
Post{blog(name)} to Blog
}
relationship ManyToMany {
Post{tag(name)} to Tag{post}
}
search Blog, Post, Tag with no
paginate Post, Tag with infinite-scroll
- drop migrate from .yo-rc.json and package.json (it's not suppose to be there) and commit. upgrade generator does not support blueprints.
- remove generator-jhipster from global to avoid conflict with npx
npm -g uninstall generator-jhipster - upgrade using
npx -y -- [email protected] upgrade
@mshima I tried your suggestions and they worked. It seems like we need to update our documentation because npx jhipster upgrade does not work. In this PR, I used the following sequence:
- Removed the migrate blueprint from .yo-rc.json and package.json, committed and pushed changes
- Ran
npx jhipster upgrade, added the changes from package-lock.json, committed and pushed - Ran
npx -y -- [email protected] upgradeand pushed the changes
IMHO, it seems like it's easier to remember jhipster-migrate than it is to remember the last command.
One other strange thing I noticed is the build tool prompt has Maven and Gradle in lowercase.
I also noticed that the questions seem to be in a random order compared to 8.1.0. Here are the questions from 8.1.0:
With 8.4.0, many of the client questions are asked first, then the Cypress questions are asked at the end. Having the questions change order between releases makes it hard to write evergreen tutorials about JHipster.
Also, there's a warning about relationships between entities and I haven't created any yet.
@mshima I tried your suggestions and they worked. It seems like we need to update our documentation because
npx jhipster upgradedoes not work. In this PR, I used the following sequence:
- Removed the migrate blueprint from .yo-rc.json and package.json, committed and pushed changes
- Ran
npx jhipster upgrade, added the changes from package-lock.json, committed and pushed- Ran
npx -y -- [email protected] upgradeand pushed the changesIMHO, it seems like it's easier to remember
jhipster-migratethan it is to remember the last command.
Using global installation, they are equivalent: upgrade:
npm install -g generator-jhipster@latestjhipster upgrade
migrate:
npm install -g generator-jhipster-migrate@latestjhipster-migrate
npx alternative can be simplified:
npx generator-jhipster@latest upgradeand a prompt may be asked.
I just noticed another typo in the questions. Junit should be JUnit.
Here's a PR to update the instructions: https://github.com/jhipster/jhipster.github.io/pull/1346
With 8.4.0, many of the client questions are asked first, then the Cypress questions are asked at the end. Having the questions change order between releases makes it hard to write evergreen tutorials about JHipster.
We will need a new priority to make every backend generator to configure before client generators.
@mraible is something missing?
The upgrade instructions have been updated and other issues have been fixed, so I'll close this as resolved.