JHipster

From BITPlan Wiki
Revision as of 07:15, 27 December 2018 by Wf (talk | contribs) (→‎example)
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.

First Steps

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.

source

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

Troubleshooting

frontend-maven-plugin issue

Execution install node and npm of goal com.github.eirslett:frontend-maven-plugin:1.6:install-node-and-npm failed: A required class was missing while executing com.github.eirslett:frontend-maven-plugin:1.6:install-node-and-npm: org/apache/http/protocol/HttpContext

checking the relevant files from the issue

#!/bin/bash
# WF 2018-12-26
# check issue
files() {
cat << EOF
[ERROR] urls[0] = file:/Users/wf/.m2/repository/com/github/eirslett/frontend-maven-plugin/1.6/frontend-maven-plugin-1.6.jar
[ERROR] urls[1] = file:/Users/wf/.m2/repository/com/github/eirslett/frontend-plugin-core/1.6/frontend-plugin-core-1.6.jar
[ERROR] urls[2] = file:/Users/wf/.m2/repository/org/codehaus/jackson/jackson-mapper-asl/1.9.13/jackson-mapper-asl-1.9.13.jar
[ERROR] urls[3] = file:/Users/wf/.m2/repository/org/codehaus/jackson/jackson-core-asl/1.9.13/jackson-core-asl-1.9.13.jar
[ERROR] urls[4] = file:/Users/wf/.m2/repository/org/apache/commons/commons-compress/1.5/commons-compress-1.5.jar
[ERROR] urls[5] = file:/Users/wf/.m2/repository/org/tukaani/xz/1.2/xz-1.2.jar
[ERROR] urls[6] = file:/Users/wf/.m2/repository/commons-io/commons-io/1.3.2/commons-io-1.3.2.jar
[ERROR] urls[7] = file:/Users/wf/.m2/repository/org/apache/commons/commons-exec/1.3/commons-exec-1.3.jar
[ERROR] urls[8] = file:/Users/wf/.m2/repository/org/apache/httpcomponents/httpclient/4.5.1/httpclient-4.5.1.jar
[ERROR] urls[9] = file:/Users/wf/.m2/repository/org/apache/httpcomponents/httpcore/4.4.3/httpcore-4.4.3.jar
[ERROR] urls[10] = file:/Users/wf/.m2/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar
[ERROR] urls[11] = file:/Users/wf/.m2/repository/commons-codec/commons-codec/1.9/commons-codec-1.9.jar
[ERROR] urls[12] = file:/Users/wf/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.22/plexus-utils-3.0.22.jar
[ERROR] urls[13] = file:/Users/wf/.m2/repository/javax/enterprise/cdi-api/1.0/cdi-api-1.0.jar
[ERROR] urls[14] = file:/Users/wf/.m2/repository/com/google/guava/guava/10.0.1/guava-10.0.1.jar
[ERROR] urls[15] = file:/Users/wf/.m2/repository/com/google/code/findbugs/jsr305/1.3.9/jsr305-1.3.9.jar
[ERROR] urls[16] = file:/Users/wf/.m2/repository/org/sonatype/sisu/sisu-guice/3.1.0/sisu-guice-3.1.0-no_aop.jar
[ERROR] urls[17] = file:/Users/wf/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar
[ERROR] urls[18] = file:/Users/wf/.m2/repository/org/eclipse/sisu/org.eclipse.sisu.inject/0.0.0.M2a/org.eclipse.sisu.inject-0.0.0.M2a.jar
[ERROR] urls[19] = file:/Users/wf/.m2/repository/asm/asm/3.3.1/asm-3.3.1.jar
[ERROR] urls[20] = file:/Users/wf/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
[ERROR] urls[21] = file:/Users/wf/.m2/repository/org/apache/maven/plugin-tools/maven-plugin-annotations/3.2/maven-plugin-annotations-3.2.jar
[ERROR] urls[22] = file:/Users/wf/.m2/repository/org/sonatype/plexus/plexus-build-api/0.0.7/plexus-build-api-0.0.7.jar
EOF
}
for file in $(files | cut -f2 -d'=' | sed 's/file://')
do
  ls -l $file | grep "26 Dez"
  if [ $? -eq 0 ]
  then
    rm $file
  fi
done

-rw-r--r--  1 wf  staff  34939 26 Dez 11:49 /Users/wf/.m2/repository/com/github/eirslett/frontend-maven-plugin/1.6/frontend-maven-plugin-1.6.jar
-rw-r--r--  1 wf  staff  68781 26 Dez 11:49 /Users/wf/.m2/repository/com/github/eirslett/frontend-plugin-core/1.6/frontend-plugin-core-1.6.jar
-rw-r--r--  1 wf  staff  202137 26 Dez 11:49 /Users/wf/.m2/repository/org/eclipse/sisu/org.eclipse.sisu.inject/0.0.0.M2a/org.eclipse.sisu.inject-0.0.0.M2a.jar

Links