JHipster

From BITPlan Wiki
Jump to navigation Jump to search

What is JHipster

JHipster generates (scaffolds) a complete Java backend / Web Frontend project based on answering a few configuration option questions.

Steps

The scripts are available at https://gist.github.com/WolfgangFahl/900b438ea89dfb1e8e19ce138d6ffac1

"run" script

get the run script (or cut & paste from below) and run it

curl https://gist.githubusercontent.com/WolfgangFahl/900b438ea89dfb1e8e19ce138d6ffac1/raw/2aa6d7914b8903739840c8dad264617c4b26a8d9/run -s -o run
chmod +x run
./run

start jhipster generator in container

start bash in container

docker exec -it jhipster /bin/bash

in the container run jhipster:

jhipster

answer the questions. See descriptions below for more details. exit the container

check in result to git

cd $HOME/jhipster
git commit -a

 create mode 100644 .editorconfig
 create mode 100644 .gitattributes
 create mode 100644 .gitignore
 create mode 100644 .huskyrc
...

start

./mvnw

Scripts

docker run script

the run script has no options and will

  1. pull the jhipster docker image (only once)
  2. run the jhipster docker container (only once)
  3. restart the jhipster docker container (if not running)

example

./run
found 0 jhipster image(s)
pulling jhipster image
Using default tag: latest
latest: Pulling from jhipster/jhipster
32802c0cfa4d: Pull complete 
da1315cffa03: Pull complete 
fa83472a3562: Pull complete 
f85999a86bef: Pull complete 
8068599e93d7: Downloading  256.5MB/290.5MB
...
5f003c15440b: Download complete 
01db67787b7a: Download complete 
Digest: sha256:a7f3fc2919f3b8873b5c362466fc95ec45c305338aae1283e1b41d39b883a6a4
Status: Downloaded newer image for jhipster/jhipster:latest
creating /Users/wf/jhipster
checking whether jhipster container exists
running jhipster container
7de49e51282aa5364fbbda1138bff560fd0aef306752692520fbe21d9e9ec0bc

run

#!/bin/bash
# WF 2018-12-26
# see https://www.jhipster.tech/installation/

# how many jhipster images have been installed?
# check how many lines the image command creates
imagecount=$(docker images jhipster/jhipster | wc -l)
#REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
#jhipster/jhipster   latest              71562063f279        4 days ago          1.04GB
# substract the repository line
imagecount=$(($imagecount-1))
echo "found $imagecount jhipster image(s)"
# if there is no image yet - get it
if [ $imagecount -eq 0 ]
then
  echo "pulling jhipster image"
  docker image pull jhipster/jhipster
fi
jhipsterhome=~/jhipster
if [ ! -d $jhipsterhome ]
then
  echo "creating $jhipsterhome"
  mkdir $jhipsterhome
fi
echo "checking whether jhipster container exists"
container=$(docker ps -a -q --filter="name=jhipster")
if [ "$container" = "" ]
then
  echo "running jhipster container"
  docker container run --name jhipster -v ~/jhipster:/home/jhipster/app -v ~/.m2:/home/jhipster/.m2 -p 8080:8080 -p 9000:9000 -p 3001:3001 -d -t jhipster/jhipster
else
  echo "checking whether jhipster container $container runs"
  running=$(docker ps -q --filter="id=$container")
  if [ "$running" = "" ]
  then
    echo "starting jhipster container $container"
    docker start $container
  fi
fi

bash

example

./bashit 
jhipster@7de49e51282a:~/app$ jhipster
INFO! Using JHipster version installed globally
INFO! Running default command
INFO! Executing jhipster:app
INFO! Options: from-cli: true


        ██╗ ██╗   ██╗ ████████╗ ███████╗   ██████╗ ████████╗ ████████╗ ███████╗
        ██║ ██║   ██║ ╚══██╔══╝ ██╔═══██╗ ██╔════╝ ╚══██╔══╝ ██╔═════╝ ██╔═══██╗
        ██║ ████████║    ██║    ███████╔╝ ╚█████╗     ██║    ██████╗   ███████╔╝
  ██╗   ██║ ██╔═══██║    ██║    ██╔════╝   ╚═══██╗    ██║    ██╔═══╝   ██╔══██║
  ╚██████╔╝ ██║   ██║ ████████╗ ██║       ██████╔╝    ██║    ████████╗ ██║  ╚██╗
   ╚═════╝  ╚═╝   ╚═╝ ╚═══════╝ ╚═╝       ╚═════╝     ╚═╝    ╚═══════╝ ╚═╝   ╚═╝

                            https://www.jhipster.tech

Welcome to JHipster v5.7.2
Application files will be generated in folder: /home/jhipster/app
 _______________________________________________________________________________________________________________

  Documentation for creating an application is at https://www.jhipster.tech/creating-an-app/
  If you find JHipster useful, consider sponsoring the project at https://opencollective.com/generator-jhipster
 _______________________________________________________________________________________________________________

? May JHipster anonymously report usage statistics to improve the tool over time? No
? Which *type* of application would you like to create? Monolithic application (recommended for simple projects)
? What is the base name of your application? jhipstertest
? What is your default Java package name? com.bitplan.jhipstertest
? Do you want to use the JHipster Registry to configure, monitor and scale your application? No
? Which *type* of authentication would you like to use? JWT authentication (stateless, with a token)
? Which *type* of database would you like to use? SQL (H2, MySQL, MariaDB, PostgreSQL, Oracle, MSSQL)
? Which *production* database would you like to use? MySQL
? Which *development* database would you like to use? H2 with disk-based persistence
? Do you want to use the Spring cache abstraction? Yes, with the Ehcache implementation (local cache, for a single node)
? Do you want to use Hibernate 2nd level cache? Yes
? Would you like to use Maven or Gradle for building the backend? Maven
? Which other technologies would you like to use? 
? Which *Framework* would you like to use for the client? (Use arrow keys)
❯ Angular 
  React 
...
? Would you like to enable *SASS* stylesheet preprocessor? Yes
? Would you like to enable internationalization support? Yes
? Please choose the native language of the application English
? Please choose additional languages to install 
? Besides JUnit and Jest, which testing frameworks would you like to use? 
? Would you like to install other generators from the JHipster Marketplace? (y/N) n

Installing languages: en
Git repository initialized.

KeyStore 'src/main/resources/config/tls/keystore.p12' generated successfully.

   create .prettierrc
   create .prettierignore
   create src/main/jib/entrypoint.sh
   create src/main/docker/Dockerfile

I'm all done. Running npm install for you to install the required dependencies. If this fails, try running the command yourself.
npm WARN deprecated swagger-ui@2.2.10: No longer maintained, please upgrade to swagger-ui@3.
npm WARN deprecated kleur@2.0.2: Please upgrade to kleur@3 or migrate to 'ansi-colors' if you prefer the old syntax. Visit <https://github.com/lukeed/kleur/releases/tag/v3.0.0\> for migration path(s).
[         .........] \ extract:through: sill tarball no local data for find-up@^1.0.0. Extracting by manifest.
npm WARN ajv-keywords@2.1.1 requires a peer of ajv@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-plugin-prettier@3.0.0 requires a peer of eslint@>= 5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN realworld-vue@0.1.0 No repository field.
npm WARN realworld-vue@0.1.0 No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

audited 35208 packages in 47.399s
found 0 vulnerabilities

...
Application successfully committed to Git.

If you find JHipster useful consider sponsoring the project https://www.jhipster.tech/sponsors/

Server application generated successfully.

Run your Spring Boot application:
./mvnw

Client application generated successfully.

Start your Webpack development server with:
 npm start


> jhipstertest@0.0.0 cleanup /home/jhipster/app
> rimraf target/{aot,www}

INFO! Congratulations, JHipster execution is complete!

source

#!/bin/bash
# WF 2018-12-26
# run a bash shell in the jhipster docker image
docker exec -it jhipster /bin/bash

Links

Stackoverflow questions