DEV Community

Cover image for JHipster 7: What’s under the hood?
Anthony Viard 🥑 for Entando

Posted on • Updated on • Originally published at entando.com

JHipster 7: What’s under the hood?

Hi, my fellow hipsters!
I know you’ve been waiting for this announcement for a long time. JHipster 7 has been released! This is a BIG major version so I can’t promise to cover every detail in the release, but I’d like to share my favorite features with you.

Let’s go for a quick overview.

A few numbers to start

  • 22 months have passed since the last major release has been made
  • 25 intermediate releases, one release every 3.5 weeks
  • 3833 commits have been merged
  • 2371 tickets/PR have been closed
  • 18.2k GitHub stars and 613 contributors

The v7 release is for sure the biggest release made by the community.

Getting started with JHipster

Nothing new here. You need Node/npm and Java installed on your computer to generate and start your apps.

npm install -g generator-jhipster
Enter fullscreen mode Exit fullscreen mode

And then, in your folder:

jhipster
Enter fullscreen mode Exit fullscreen mode

Note that from this JHipster version you will need Java 11 to run your app, but I will get back on this modification later.

Screenshot_20210324_at_16.07.35_d0

New major features

My 4 favorite backend features

Java 11 by default

Java 11 is now the default version defined in your project and the version used to generate your container’s image with JIB. If you are still using Java 8, we highly recommend moving to Java 11, but you can still use it by switching back to Java 8.

Here’s an example in pom.xml using Maven:

<java.version>11</java.version>
Enter fullscreen mode Exit fullscreen mode
<plugin>
    <groupId>com.google.cloud.tools</groupId>
    <artifactId>jib-maven-plugin</artifactId>
    <version>${jib-maven-plugin.version}</version>
    <configuration>
        <from>
            <image>adoptopenjdk:11-jre-hotspot</image>
        </from>
Enter fullscreen mode Exit fullscreen mode

Prettier for Java

Did you know Prettier for Java is a JHipster project?

Did you know that you can format your code with it in JHipster 6.x.x versions by using the --prettier-java flag when you generate your application?

In JHipster 7 we have enabled the usage of Prettier everywhere it’s possible, even in Java.

  1. During generation, we can ensure the files are correctly generated.
  2. During development, using a Git hook, so your code will be well formatted.

JHipster 7 automatically uses Prettier to format most files including md, json, yml, html, js, ts, tsx, css, scss, vue and java.

Incremental Liquibase changesets with your Entities

In JHipster we love Liquibase to handle data migration, to initialize our database, or to upgrade an existing schema.

In the past, JHipster used to regenerate the whole changesets to keep the schema up to date. The main issue was that if your application has been deployed somewhere and you want to introduce entities (and the schema changes related to them), you faced issues with Liquibase.

In fact, Liquibase checks your passed changeset checksum before playing the new ones. If they have changed, Liquibase raises an error and won't let you upgrade your schema.

Now with JHipster 7, you can use incremental changesets by using the incremental-changelog flag when you generate your application.

jhipster --incremental-changelog
Enter fullscreen mode Exit fullscreen mode

If you want to recreate the changelog when you import a modified JDL or when you run the entity generator again, use --recreate-initial-changelog. An initial changelog will be created for every entity, but none will be deleted.

Distinguish generated classes

In the past, you probably wondered which files were generated by JHipster or added by the dev team. For example, do you want to exclude JHipster classes when running a Sonar analysis?

JHipster 7 comes with a solution for you.

jhipster --with-generated-flag
Enter fullscreen mode Exit fullscreen mode

This will generate a new annotation definition file and will use it on each generated file.

Screen_Shot_20210419_at_8.20.33_AM_d0

My 3 favorite frontend features

Vue, your new frontend companion

If you are already familiar with the blueprint pattern and the Vue framework, you know what I’m talking about. Otherwise, forget that and use JHipster 7. Vue is now an option in the frontend choices and it does not need any external installation.

For previous versions of JHipster, you can continue to use the Vue blueprint. Note that this blueprint is now deprecated since we’ve now included it by default.

Screen_Shot_20210419_at_8.20.43_AM_d0

A lightweight frontend app without the admin UI

You can now decide to not include the admin UI in your application and generate fewer files for a lightweight bundle.

If you decide not to include the admin UI, all the users, metrics, logs, etc. will not be generated. JHipster Control Center is the recommended way to monitor your applications when you have multiple monoliths or microservices so you can monitor everything from one place. The admin-UI is best when you want to monitor everything from within the same app.

Screenshot_20210319_at_18.37.56_d0

Note that the Audit feature, usually available in the admin-UI, has been totally removed from JHipster and will not be available anymore.

Cypress

Cypress is a testing tool to test everything in a browser. You have probably already heard about protractor in JHipster. We decided to deprecate it and introduce Cypress as the new alternative.

If you decide to choose Cypress on the testing framework you will be able to run it out of the box with the following command:

To open the Cypress UI

npm run e2e
Enter fullscreen mode Exit fullscreen mode

To open the Cypress UI and run the tests

npm run e2e:cypress
Enter fullscreen mode Exit fullscreen mode

To run the tests in headless mode

npm run e2e:cypress:headless
Enter fullscreen mode Exit fullscreen mode

Screenshot_20210319_at_18.38.11_d0

JHipster Control Center

JHipster Control Center (JHCC) is a Vue application that allows you to control and monitor all your JHipster applications from one place. It works with static discovery (by using static IP addresses) or with Eureka and Consul for service discovery. Kubernetes support is present but not fully available at this moment.

JHipster Control Center has all of the pages you used to have in your generated application such as metrics, configurations, and even Swagger-UI.

You can also decide to enable log tracking to read all of your logs from the JHipster Control Center (you will need to enable it in your application for security reasons).

JHipster Control Center is the recommended way to monitor your applications when you have multiple monoliths or microservices so you can monitor everything from one place. The admin-UI is best when you want to monitor everything from within the same app.

A JHipster application automatically embeds a JHipster Control Center docker-compose file to allow you to start quickly by using this command (you will need docker installed on your computer):

docker-compose -f src/main/docker/jhipster-control-center.yml up
Enter fullscreen mode Exit fullscreen mode

You can find a JHCC demo (made during the beta) on my YouTube channel:

JHipster at Entando

You probably already know that, Entando develops a JHipster blueprint to generate Entando microservices, micro frontends and to deploy them to the platform.

We are glad our users can benefit from these last features, but we also keep in mind a major version needs more time to be studied since it introduces breaking changes.

I would like to thank all the people who contributed to this new major version. It’s an incredible work done by open source contributors to make developers’ lives easier.

At Entando, we love JHipster and are glad to be a part of this community.

We hope you will enjoy this new version as much as we will.

Get more information

If you want to get more information about this release, be sure to check the official release note.

If you have questions you reach me on Twitter or use the official account handle.

Top comments (0)