Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npx jhipster upgrade doesn't work to upgrade an app from 8.3.0 to 8.4.0 #26057

Closed
mraible opened this issue May 7, 2024 · 9 comments
Closed

Comments

@mraible
Copy link
Contributor

mraible commented May 7, 2024

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.

Screenshot 2024-05-07 at 11 02 57 AM
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

#25033

Suggest a Fix

Update the documentation to recommend the migrate blueprint, change the upgrade command so it works.

JHipster Version(s)
blog@0.0.1-SNAPSHOT /Users/mraible/dev/jhipster8-demo
├─┬ generator-jhipster-migrate@1.0.0
│ └── generator-jhipster@8.3.0 deduped
└── generator-jhipster@8.3.0
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

@mshima
Copy link
Member

mshima commented May 7, 2024

  • 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 -- generator-jhipster@8.4.0 upgrade

@mraible
Copy link
Contributor Author

mraible commented May 8, 2024

@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:

  1. Removed the migrate blueprint from .yo-rc.json and package.json, committed and pushed changes
  2. Ran npx jhipster upgrade, added the changes from package-lock.json, committed and pushed
  3. Ran npx -y -- generator-jhipster@8.4.0 upgrade and pushed the changes

IMHO, it seems like it's easier to remember jhipster-migrate than it is to remember the last command.

@mraible
Copy link
Contributor Author

mraible commented May 8, 2024

One other strange thing I noticed is the build tool prompt has Maven and Gradle in lowercase.

Screenshot 2024-05-07 at 6 37 25 PM

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:

JHipster 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.

Screenshot 2024-05-07 at 6 39 08 PM

Also, there's a warning about relationships between entities and I haven't created any yet.

@mshima
Copy link
Member

mshima commented May 8, 2024

@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:

  1. Removed the migrate blueprint from .yo-rc.json and package.json, committed and pushed changes
  2. Ran npx jhipster upgrade, added the changes from package-lock.json, committed and pushed
  3. Ran npx -y -- generator-jhipster@8.4.0 upgrade and pushed the changes

IMHO, it seems like it's easier to remember jhipster-migrate than it is to remember the last command.

Using global installation, they are equivalent:
upgrade:

  1. npm install -g generator-jhipster@latest
  2. jhipster upgrade

migrate:

  1. npm install -g generator-jhipster-migrate@latest
  2. jhipster-migrate

npx alternative can be simplified:

  1. npx generator-jhipster@latest upgrade and a prompt may be asked.

@mraible
Copy link
Contributor Author

mraible commented May 8, 2024

I just noticed another typo in the questions. Junit should be JUnit.

@mraible
Copy link
Contributor Author

mraible commented May 8, 2024

Here's a PR to update the instructions: jhipster/jhipster.github.io#1346

@mshima
Copy link
Member

mshima commented May 8, 2024

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.

@mshima
Copy link
Member

mshima commented May 20, 2024

@mraible is something missing?

@mraible
Copy link
Contributor Author

mraible commented May 21, 2024

The upgrade instructions have been updated and other issues have been fixed, so I'll close this as resolved.

@mraible mraible closed this as completed May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants