JHipster

From BITPlan Wiki
Revision as of 07:09, 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

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

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