Issue
I want to upgrade an app which was built with jhipster 4.14.4 to 7.9.2 the latest version right now.
Do you have any ideas how should I proceed ? (the steps to follow)(the best way to do it)
I already read this : href="https://www.jhipster.tech/upgrading-an-application/" rel="nofollow noreferrer">https://www.jhipster.tech/upgrading-an-application/ but i am still confused. I already tried with the automatic upgrade which ended with a lot of conflict to solve. I don't know if i should continue in that direction or change my strategy. Because some other developers told me to create another project with 7.9.2 and copy the old code step by step and then resolve problems.
thanks.
Solution
Before asking how to upgrade, the first question to ask is why?
What are the benefits you expect from upgrading JHipster versus upgrading your app manually to make it run under latest versions of Java and Spring Boot and other libs?
Usually when you want to upgrade an application, it's to get support for patching security vulnerabilities or to be able to use more modern libs before starting a major functional evolution. You can get all these benefits by updating manually your code at a fraction of cost especially when your app is several major versions behind JHipster.
Unless your project is trivial, its value reside in your custom code not in code generated by JHipster.
So, it usually does not make sense to keep a dependency with the code generator, it just adds technical debt when you are unlikely to use it anymore.
In my projects, I usually cut off all dependencies with JHipster after few months, it makes it so much easier to upgrade libs and frameworks.
As an analogy, you would not keep scaffolding after your house is built.
That said, if you still want to do it, there are 2 alternatives:
Using jhipster upgrade
In your case the effort is multiplied by 3 because your app is 3 major versions behind current JHipster. Each major version introduces its share of breaking changes including dropping some components. So in some rare cases you just couldn't upgrade depending on the options you chose for initial project generation.
So, first step is to review the breaking changes introduced by each major release, see https://www.jhipster.tech/releases/
jhipster upgrade
will likely fail if you want to go directly from 4 to 7 so you should probably go from 4 to 5, 5 to 6, 6 to 7. It will take long time and effort and there's a risk that you will fail.
Starting from fresh project and importing custom code
Generating a new app in 7 and then importing your custom business code is probably a better idea.
If you have kept the JDL file used for initial generation then it's easy.
If you don't have this JDL file or app was built by answering questions, you can use jhipster export-jdl
.
So now you have the JDL and you can create your app in an empty directory, and generate your app with latest version using jhipster import-jdl
.
Then you should start importing custom code into new app.
Whichever way you choose, you must be knowledgeable about the technology stack used by JHipster. So to be clear: giving this task to a junior dev does not make any sense.
Answered By - Gaël Marziou
Answer Checked By - Mildred Charles (JavaFixing Admin)