Difference between revisions of "JHipster"

From BITPlan Wiki
Jump to navigation Jump to search
 
(14 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
JHipster generates (scaffolds) a complete Java backend / Web Frontend project based on
 
JHipster generates (scaffolds) a complete Java backend / Web Frontend project based on
 
answering a few configuration option questions.
 
answering a few configuration option questions.
= First Steps =
+
= 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
 +
<source docker='bash'>
 +
curl https://gist.githubusercontent.com/WolfgangFahl/900b438ea89dfb1e8e19ce138d6ffac1/raw/2aa6d7914b8903739840c8dad264617c4b26a8d9/run -s -o run
 +
chmod +x run
 +
./run
 +
</source>
 +
== start jhipster generator in container ==
 +
start bash in container
 +
<source lang='bash'>
 +
docker exec -it jhipster /bin/bash
 +
</source>
 +
in the container run jhipster:
 +
<source lang='bash'>
 +
jhipster
 +
</source>
 +
answer the questions. See descriptions below for more details.
 +
exit the container
 +
== check in result to git ==
 +
<source lang='bash'>
 +
cd $HOME/jhipster
 +
git commit -a
 +
 +
create mode 100644 .editorconfig
 +
create mode 100644 .gitattributes
 +
create mode 100644 .gitignore
 +
create mode 100644 .huskyrc
 +
...
 +
</source>
 +
== start ==
 +
<source lang='bash'>
 +
./mvnw
 +
</source>
  
 
= Scripts =
 
= Scripts =
Line 80: Line 114:
 
=== example ===
 
=== example ===
 
<source lang='bash'>
 
<source lang='bash'>
./bashit
+
./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>
 
</source>
 +
 
=== source ===
 
=== source ===
 
<source lang='bash'>
 
<source lang='bash'>
Line 89: Line 216:
 
docker exec -it jhipster /bin/bash
 
docker exec -it jhipster /bin/bash
 
</source>
 
</source>
= Troubleshooting =
 
==  frontend-maven-plugin issue ==
 
<pre>
 
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
 
</pre>
 
* https://github.com/eirslett/frontend-maven-plugin/issues/783
 
 
== checking the relevant files from the issue ==
 
<source lang='bash'>
 
#!/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
 
</source>
 
 
 
= Links =
 
= Links =
 
* https://www.jhipster.tech/
 
* https://www.jhipster.tech/
Line 147: Line 221:
 
* https://stackoverflow.com/questions/tagged/jhipster
 
* https://stackoverflow.com/questions/tagged/jhipster
 
* https://www.jhipster.tech/docker-compose/
 
* https://www.jhipster.tech/docker-compose/
 +
= Stackoverflow questions =
 +
* https://stackoverflow.com/questions/44490021/jhipster-docker-image-from-dockerhub-is-not-working

Latest revision as of 08:13, 27 December 2018

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