JHipster
Develop and Deploy Microservices With JHipster
Description
Repository : https://github.com/masteringjhipster
JDL
JHipster Domain Language (http://www.jhipster.tech/jdl/) enables to describe the JHipster application (backend, frontend, microservice) for gen
- Entities (User is a builtin entity)
- Relationships between entities
- Services
- Pagination modes for listing the entities in the frontend.
Example: bug-tracker.jh
entity Project { name String } entity Label { label String required minlength(3) } entity Ticket { title String required, description String, dueDate LocalDate, done Boolean } relationship ManyToMany { Ticket{label(label)} to Label{ticket} } relationship ManyToOne { Ticket{project(name)} to Project } relationship ManyToOne { Ticket{assignedTo(login)} to User{ticket} } paginate Ticket with pagination
The type system is :
- TODO
Getting started
# install NodeJS and NPM TODO # install Yarn TODO # install Yeoman TODO # install the demo app git clone https://github.com/jhipster/jhipster-sample-app.git cd jhipster-sample-app/ yarn install yarn global add gulp-cli # start the demo app ./mvnw # start gulp for relaunch the update gulp # open the browsers open http://localhost:9001/#/ open http://localhost:8080 # inspect the generation files used by jhispter-generator more .jhipster/*.json
Generate an application (Bug Tracker)
Other schemes for application generation
git clone https://github.com/jhipster/jdl-samples.git mkdir jhipster-bugtracker cd jhipster-bugtracker jhipster
? (1/16) Which *type* of application would you like to create? Monolithic applic ation (recommended for simple projects) ? (2/16) What is the base name of your application? bugtracker ? (3/16) What is your default Java package name? example.bugtracker ? (4/16) Do you want to use the JHipster Registry to configure, monitor and scal e your application? No ? (5/16) Which *type* of authentication would you like to use? JWT authenticatio n (stateless, with a token) ? (6/16) Which *type* of database would you like to use? SQL (H2, MySQL, MariaDB , PostgreSQL, Oracle, MSSQL) ? (7/16) Which *production* database would you like to use? MySQL ? (8/16) Which *development* database would you like to use? H2 with disk-based persistence ? (9/16) Do you want to use Hibernate 2nd level cache? No ? (10/16) Would you like to use Maven or Gradle for building the backend? Maven ? (11/16) Which other technologies would you like to use? Social login (Google, Facebook, Twitter), Search engine using Elasticsearch, WebSockets using Spring W ebsocket ? (12/16) Which *Framework* would you like to use for the client? Angular 4 ? (13/16) Would you like to use the LibSass stylesheet preprocessor for your CSS ? Yes ? (14/16) Would you like to enable internationalization support? Yes ? Please choose the native language of the application French ? Please choose additional languages to install English ? (15/16) Besides JUnit and Karma, which testing frameworks would you like to us e? Gatling, Cucumber, Protractor ? (16/16) Would you like to install other generators from the JHipster Marketpla ce? No
jhipster import-jdl ../jdl-samples/bug-tracker.jh
# install the dependencies yarn install # start the demo app ./mvnw # start gulp for relaunch the update gulp # open the browsers open http://localhost:9001/#/ open http://localhost:8080
Update the generated application
Update the generated application with the following JDL document.
DEFAULT_MIN = 1 DEFAULT_MAX = 3 /** * This is a project to track * @author Didier */ entity Project { name String required minlength(6) pattern("^[-_ a-zA-Z0-9]*$") } /** * This is a label for tagging the projects * @author Didier */ entity Label { /** * The name of the label */ label String required minlength(3) } entity Ticket { /** * The title of the ticket */ title String required, description String, priority Integer min(DEFAULT_MIN) max(DEFAULT_MAX) dueDate LocalDate, done Boolean } relationship ManyToMany { Ticket{label(label)} to Label{ticket} } relationship ManyToOne { Ticket{project(name)} to Project } relationship ManyToOne { Ticket{assignedTo(login)} to User{ticket} } dto * with mapstruct angularSuffix * with bt paginate Ticket with pagination
Code Quality
Lancement de sonarqube sur votre machine
docker run -d --name sonarqube -p 9000:9000 -p 9092:9092 sonarqube
ou
docker-compose src/main/docker/sonar.yml up
Ajout de ~/.m2/settings.xml pour sonarqube https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+Maven
Lancement de l’analyse sonar avec Maven
cd ~/monolith; ./mvnw clean verify sonar:sonar
Visualisez le rapport sur http://localhost:9000/dashboard
Si votre projet est construit avec Gradle : https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+Gradle
Code review
- Import the Maven project into your favorite IDE (Eclipse for me ;-)
- (Optional) Install Angular IDE plugin into your (Eclipse) IDE.
- Browse src/main/java for looking the Java code of the generated Spring backend
- Browse src/main/resources for looking the default resources of the generated Spring backend
- Browse src/main/webapp for looking the HTML and TypeScript code of the generated Anjular 2 frontend
- Browse src/main/docker for looking the Dockerfiles of the application containers
Screenshot Angular 2 part
Screenshot Spring
Screenshot Spring
Screenshot Docker
Add subgenerator from the Marketplace
- Heroku
- Docker
- CI
- PrimeNG
- Leaflet
- Entity Audit
- Multi-tenancy
- Swagger CLI
- Swagger2markup
La liste complète https://www.jhipster.tech/modules/marketplace/#/list
Add a new module from the Marketplace
Choose a module to install into the Marketplace (for instance, OSM maps with Leaflet).
npm install -g generator-jhipster-leaflet yo jhipster-leaflet
Extra frontend libs
- PrimeNG
- VMWare Clarity
Extra frontend
JDL Studio
More
From
git clone https://github.com/mraible/21-points.git cd 21-points # install the dependencies yarn install # start the demo app ./gradlew