Skip to content

Commit 0e1c162

Browse files
author
Nicolas Romanetti
committed
how to run a single jar...
1 parent c1b392e commit 0e1c162

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

quickstart/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ Then open [http://localhost:4200/](http://localhost:4200/)
4242
* Commands above are explained [here](#generate-it-and-run-it)
4343
* [Delete all generated files](#delete-all-generated-files)
4444
* [How-to use your own database](#how-to-use-your-own-database)
45+
* [How-to package front/back in a single jar and run it](#how-package)
4546

4647
## Generate it and run it
4748

@@ -157,3 +158,32 @@ Follow the steps 2-3 from the [Generate it and run it](#generate-it-and-run-it)
157158

158159
[pom.xml]: https://github.com/jaxio/celerio-angular-quickstart/blob/master/quickstart/pom.xml
159160
[entity.service.ts.e.vm]: https://github.com/jaxio/celerio-angular-quickstart/blob/master/pack-angular/celerio/pack-angular/web/src/app/entities/entity.service.ts.e.vm
161+
162+
## How-to package front/back in a single jar and run it
163+
164+
Let's go one step further. Wouldn't it be convenient for production to only have a single jar to run ?
165+
166+
To create a single jar (Java archive), in addition to the steps above we need to compile the front end code (typescript etc.)
167+
using Angular Cli and to copy the compilation result (dist folder) in our springboot backend (in a special folder
168+
for static content) so it can be packaged into a jar file along with the backend.
169+
170+
Here are the command lines (hope it is self explanatory):
171+
172+
git clone https://github.com/jaxio/celerio-angular-quickstart.git
173+
cd celerio-angular-quickstart/quickstart
174+
ng new web
175+
rm web/src/main.ts web/src/app/app.module.ts web/src/app/app.component.* web/src/styles.css
176+
mvn -Pdb,metadata,gen generate-sources
177+
cd web
178+
npm install --save @angular/animations
179+
npm install --save @angular/material@2.0.0-beta.3
180+
npm install --save primeng@4.0.0
181+
npm install --save font-awesome
182+
ng build --prod
183+
cp dist/* ../src/main/resources/static
184+
cd ..
185+
mvn package
186+
java -jar target/celerio-angular-quickstart-1.0.0-SNAPSHOT.jar
187+
188+
Access it at http://localhost:8080/
189+

0 commit comments

Comments
 (0)