What are the best practices to prevent code loss while regenerating application with JHipster - jhipster

What are the best practices to deal with code regeneration and custom code in some complex project using JHipster? How not to lose custom changes while regenerating the project? Our team usually consist of 5 to 10 developers.

There is an approach named as side-by-side (see https://www.youtube.com/watch?v=Gg5CYoBdpVo) that requires discipline from developers.
Also --incremental-changelog new feature of JHipster 7 can help to manage incremental changes to SQL database, even though it's currently poorly documented.
Another useful feature is to generate your project with #GeneratedByJHipster annotation in your Java classes by using jhipster --with-generated-flag
If a team of 5 to 10 devs works on same app, it will be hard anyway without JHipster but even harder with JHipster. I see several alternatives:
Use a microservice architecture to help isolating from others changes.
For a monolith, I would recommend using JHipster only for bootstrapping the app, generate few base entities and then forget about it, cut down the dependencies with JHipster and develop the project as a usual Spring Boot project.

Related

ODM Command Line Build For Classic Rule Projects

I am using ODM 8.10 and want to automate building rule app files. The code is currently configured in the old Classic Rule Project, and we are trying to avoid migrating to Decision Services at this time. I have found build jars for Decision Services but nothing so far for Classic Rule Projects. There must be a way to do this as the rule app jar files are created in the eclipse IDE when you deploy/export a ruleApp. I am trying to find out the jar files the IDE uses and the commands it calls to execute the rule app builds.
Re: "There must be a way to do this"
But you will not necessarily have access to it. The ODM product developers have experience, source code, documentation, and other tools that you do not have access to.
Having said that, there is an build/deploy API that you may be able to access via ANT. I haven't used it since switching to Decision Services when that became feasible in ODM 8.7. Standard practice before that time was to automate deployments via Ant and a "headless" version of Eclipse. If the latest online docs don't describe it, you might try the older docs.
WARNING: Classic Rule Projects are a dead end! Not only will all your effort building them in a non-standard way be wasted, I believe that it will likely be more trouble than just migrating to Decision Services (which is not usually that difficult).

Can JHipster be used to maintain a project, or just initially generate it?

Most information on the web demo generating a JHipster project, don't show a maintenance cycle using the tool. It's rather difficult to find a non-feature if that is the case. Thought I'd ask of those with experience with the tool, and hopefully document the feature or non-feature.
You can use the upgrade sub-generator to upgrade your JHipster app between releases. However, as your app grows and becomes more custom, it might make sense to use JHipster to generate your app, and then upgrade your dependencies as needed.

Any tool to go from java code to jHipster templates?

Since the generated java code doesn't fit all my needs, I would need to modify the templates (mainly in server). Small modifications are pretty straightforward but I was wondering if there is some tool to go from existing java code to this template.
We did modules for this use case, and I even did some specific ones for some clients. So this would be my favorite solution.
Then, I clearly see in our stats that many people are forking JHipster and modifying it - this is probably easier at first sight, but of course you'll have trouble when we release new versions, as you will have to sync your code with each new release.

how to integrate a monolithic jhipster application with another jhispter application. ?- Jhipster

I have made three different applications in j JHipster with monolithic. I need to merge these applications. I know that by using micro-services my quest can be easy but the current requirement is to do the merging with the monolithic pattern only.
I need to merge two applications with another or main application. I am using MySQL as database. I don't know where I need to change and how. Please help me out, I am a newbie in this scenario.
i tried to create a java file for setter getter methods and and a dao file for three databases and now in the main class file and am trying to take every dao file as an array of object and integrate it and put it into the third db.is it possible.i wanted to show the code bt,since i am new not able to maintain the coding standards to show.
by this i way i tried to involve three databases in a single scenario and want to complete my query through CRUD model.
as you already pointed out, the proper way of merging here would be using the microservice option, which you cannot take, as you are forced to use monolithic architecture...
almost automatic merge
if you did not changed anything to your code, after generating the entities, you just can put the contents of your applications .jhipster directory into one, and run yo jhipster --with-entities to regenerate the entities in one application. You should keep in mind, you will have to take a look at your main/resource/config/liquibase folder, to set the migration ids properly.
manual merge
For this you should be more experienced in the underlying technologies, as you will have to:
recreate your entity classes
recreate zour DAO/Repositories
(maybe) recreate your services, or service implementations
recreate your REST controllers
do a proper liquibase migration
provide some tests
migrate the frontend code, by adding states, components, templates etc..
the most of these things you just can copy paste already generated code.
For more information, you should ask more precise, what is not working, if you already tried something...

JHipster, Customization of generated code

i'm newbie in JHipster and i'm trying to figure this, when i create a new entity JHipster generates several files, angular, html and java classes, now if i want a common code for all this generated code i must edit each time that i use the yeoman generator? what i want is:
Custom Index template, and pages, is secure to edit them?.
Customize the entity tables, entity forms using angular, maybe extending yeoman generators
Customize generate java classes, maybe i think using AOP
So i need to edit each time for each generated code? and is a good practice this or what i want? for clarify more i want to use a Custom Bootstrap/angular Dashboard template like Minovate, i see how to customize bootstrap in the documentation but not about what i'm asking for, Thanks.
JHipster is just a code generator, once generated the code is yours.
For angular screens I would say do as much as you can in CSS/SASS.
But it's very likely that you will need to build some screen mixing several entities and change the structure of entity screens.
So you should rather consider them as a starting point and do your own stuff in another folder so that it does not get overwritten by next re-generations.
This way you can still update your entity definitions in .jhipster folder and re-run yo jhispter:entity <entity name> on the entities you modified.
Customising java Entities is usually much simpler and you can easiliy achieve this by merging generated code with git and defining your service classes.
AOP seems overkill here.
Extending a yeoman generator is a lot of work.
I suggest to use some VSC (git, subversion or whatever you like) have a branch dedicated to plain jhipster generated code and another one where you make customization.
Eventually regenerate on jhipster branch and merge back on yours.
You should at least reduce manual intervention.

Resources